I have a node.js application that pulls some data and sticks it into an object, like this: var results = new Object(); User.findOne(query, function(err, u) { results.userId = u._id;...
I have a database wrapper class that establishes a connection to some MongoDB instance: async connect(connectionString: string): Promise<void> { this.client = await MongoClient.connect(connectionString) this.db = this.client.db() } This gave...
Assuming I have a collection in MongoDB with 5000 records, each containing something similar to: { "occupation":"Doctor", "name": { "first":"Jimmy", "additional":"Smith" } Is there an easy way to rename...
Is there a simple way to do this? 22 Answers 22
I am playing around with MongoDB trying to figure out how to do a simple SELECT province, COUNT(*) FROM contest GROUP BY province But I can’t seem to figure...
I am trying to add authorization to my MongoDB. I am doing all this on Linux with MongoDB 2.6.1. My mongod.conf file is in the old compatibility format (this...
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by...
Suppose the mongodb document(table) ‘users’ is { _id: 1, name: { first: 'John', last: 'Backus' }, birth: new Date('Dec 03, 1924'), death: new Date('Mar 17, 2007'), contribs: ['Fortran', 'ALGOL',...
I know how to list all collections in a particular database, but how do I list all available databases in MongoDB shell? 7 Answers 7
Basically I have a mongodb collection called ‘people’ whose schema is as follows: people: { name: String, friends: [{firstName: String, lastName: String}] } Now, I have a very basic...