Skip to content

Instantly share code, notes, and snippets.

@gatesvp
Created May 3, 2011 00:16
Show Gist options
  • Select an option

  • Save gatesvp/952616 to your computer and use it in GitHub Desktop.

Select an option

Save gatesvp/952616 to your computer and use it in GitHub Desktop.
Reaching into documents
var x = {
"_id" : ObjectId("4dbf16ecee3bbe4d22000003"),
"options" : {
"options" : [ { "price" : { "_type" : "decimal", "val" : 1000 }, "label" : "10" }
],
"categories" : [[ "WTF","11" ]]
}
}
db.deals_test.drop();
db.deals_test.save(x);
db.deals_test.findOne({ 'options.categories.0.0' : "WTF" }); // Find the record we just inserted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment