Top "Mongodb-query" questions

This tag is for questions related to querying and updating MongoDB collections, either through the mongo shell or using a programming language driver.

Storing null vs not storing the key at all in MongoDB

It seems to me that when you are creating a Mongo document and have a field {key: value} which is …

mongodb mongodb-query document-database nosql
mongo group and count with condition

I'm trying to group a set of documents and count them based on their value. For example { "_id" : 1, "item" : "abc1", "…

mongodb mongodb-query aggregation-framework nosql
Update field with another field's value in the document

I have a collection t1 with the following fields in its schema _id, field1, field1 I want set field2's …

mongodb mongodb-query
MongoDB, performance of query by regular expression on indexed fields

I want to find an account by name (in a MongoDB collection of 50K accounts) In the usual way: we …

regex mongodb indexing mongodb-query
How to use a for loop in the mongodb shell?

How can i use a for loop in the mongo db shell? My attemps are stucking at this point: for (…

mongodb mongodb-query aggregation-framework mongo-shell mongodb-aggregation
Append item to MongoDB document array in PyMongo without re-insertion

I am using MongoDB as the back-end database for Python web application (PyMongo + Bottle). Users can upload files and optionally …

python mongodb mongodb-query pymongo
how to $project ObjectId to string value in mongodb aggregate?

Is there an operator I could use in aggregate function to get a string instead of ObjectId in response? db.…

mongodb mongodb-query aggregation-framework
How to use MongoDBs aggregate `$lookup` as `findOne()`

So as you all know, find() returns an array of results, with findOne() returning just a simply object. With Angular, …

mongodb mongodb-query aggregation-framework
Mongodb inserting doc without _id field

I am newbie to mongodb. I need to insert a doc without the _id field generating automatically. I need to …

mongodb mongodb-java mongodb-query
MongoDB - Error: getMore command failed: Cursor not found

I need to create a new field sid on each document in a collection of about 500K documents. Each sid …

node.js mongodb mongodb-query cursor