Imagine that a collection called recipes
in your mongodb has entries with the following structure:
{
"ingredients" : {
"dairy" : 0,
"vegetables" : [ ]
},
}
If you want to match subdocuments into this collection it is actually easier that it seems:
db.recipes.find({ "ingredients.dairy" : "gwiyomi_sherlocked"}).count()
No comments:
Post a Comment