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.

mongodb count num of distinct values per field/key

Is there a query for calculating how many distinct values a field contains in DB. f.e I have a …

mongodb mongodb-query aggregation-framework
MongoDB "root" user

Is there a super UNIX like "root" user for MongoDB? I've been looking at http://docs.mongodb.org/manual/reference/…

mongodb authentication mongodb-query authorization roles
Get the latest record from mongodb collection

I want to know the most recent record in a collection. How to do that? Note: I know the following …

mongodb mongodb-query
Random record from MongoDB

I am looking to get a random record from a huge (100 million record) mongodb. What is the fastest and most …

mongodb random mongodb-query
How to filter array in subdocument with MongoDB

I have array in subdocument like this { "_id" : ObjectId("512e28984815cbfcb21646a7"), "list" : [ { "a" : 1 }, { "a" : 2 }, { "a" : 3 }, { "a" : 4 }, { "a" : 5 } ] } Can I …

mongodb filter mongodb-query aggregation-framework
How to Update Multiple Array Elements in mongodb

I have a Mongo document which holds an array of elements. I'd like to reset the .handled attribute of all …

arrays mongodb mongodb-query
Mongodb find() query : return only unique values (no duplicates)

I have a collection of documents : { "networkID": "myNetwork1", "pointID": "point001", "param": "param1" } { "networkID": "myNetwork2", "pointID": "point002", "param": "param2" } { "networkID": "myNetwork1", "…

mongodb mongodb-query
MongoDB: How to query for records where field is null or not set?

I have an Email document which has a sent_at date field: { 'sent_at': Date( 1336776254000 ) } If this Email has not …

mongodb null mongodb-query exists
Redirect output of mongo query to a csv file

I am using MongoDB 2.2.2 for 32-bit Windows7 machine. I have a complex aggregation query in a .js file. I need …

mongodb mongodb-.net-driver mongodb-query
$lookup on ObjectId's in an array

What's the syntax for doing a $lookup on a field that is an array of ObjectIds rather than just a …

mongodb mongodb-query aggregation-framework