Random Tech Thoughts

The title above is not random

MongoDB

Useful documentation

From MongoDB

Querying

Querying field of embedded document in an array

Just use the dot syntax, here’s an example from Dot Notation

> db.blogposts.findOne()
{ title : "My First Post", author: "Jane",
  comments : [{ by: "Abe", text: "First" },
              { by : "Ada", text : "Good post" } ]
}
> db.blogposts.find( { "comments.by" : "Ada" } )

Find non null field

db.collection.find( { 'field': { '$ne' : null } } )