I have a Mongo document which holds an array of elements. I’d like to reset the .handled attribute of all objects in the array where .profile = XX. The...
I have a problem when querying mongoDB with nested objects notation: db.messages.find( { headers : { From: "reservations@marriott.com" } } ).count() 0 db.messages.find( { 'headers.From': "reservations@marriott.com" } ).count() 5...
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
How can I (in MongoDB) combine data from multiple collections into one collection? Can I use map-reduce and if so then how? I would greatly appreciate some example as...
I’d like to get the names of all the keys in a MongoDB collection. For example, from this: db.things.insert( { type : ['dog', 'cat'] } ); db.things.insert( { egg...
I am looking to get a random record from a huge collection (100 million records). What is the fastest and most efficient way to do so? The data is...
{ name: 'book', tags: { words:...
Suppose you have the following documents in my collection: { "_id":ObjectId("562e7c594c12942f08fe4192"), "shapes":[ { "shape":"square", "color":"blue" }, { "shape":"circle", "color":"red" } ] }, { "_id":ObjectId("562e7c594c12942f08fe4193"), "shapes":[ { "shape":"square", "color":"black" },...
In MongoDB, is it possible to update the value of a field using the value from another field? The equivalent SQL would be something like: UPDATE Person SET Name...
I’ve been playing around storing tweets inside mongodb, each object looks like this: { "_id" : ObjectId("4c02c58de500fe1be1000005"), "contributors" : null, "text" : "Hello world", "user" : { "following" :...