Vote count:
0
I have a document with embedded documents, How can I query embedded document, I need to find _content = "africa"
I have tried following queries with no result
db.cluster.find({"clusters":{"cluster":{"tag":{"_content":"africa"}}}})
db.cluster.find({"clusters.cluster.tag.[_content]":"africa"})
db.cluster.find({"clusters":{"$elemMatch":{"_content":"africa"}}})
{"clusters": {"source":"Panthera leo",
"total":2,
"cluster":[
{"total":45,
"tag":[{"_content":"lion"}, {"_content":"zoo"},
{"_content":"africa"},{"_content":"wildlife"},
{"_content":"animal"},{"_content":"lioness"},
{"_content":"bigcat"},{"_content":"cat"},
{"_content":"flickrbigcats"}, {"_content":"nature"}, {"_content":"animals"},
{"_content":"safari"}, {"_content":"leo"}, {"_content":"mammal"},
{"_content":"africanlion"}, {"_content":"lions"},
{"_content":"kenya"}, {"_content":"panthera"}, {"_content":"southafrica"},
{"_content":"nikon"},
{"_content":"feline"}, {"_content":"tanzania"}, {"_content":"felidae"},
{"_content":"cats"},
{"_content":"mane"}, {"_content":"impressedbeauty"}, {"_content":"male"},
{"_content":"animalplanet"},
{"_content":"predator"}, {"_content":"abigfave"}, {"_content":"cub"},
{"_content":"wild"}, {"_content":"bigcats"},
{"_content":"canon"}, {"_content":"african"}, {"_content":"carnivore"},
{"_content":"botswana"},
{"_content":"vosplusbellesphotos"}, {"_content":"female"},
{"_content":"anawesomeshot"},
{"_content":"malelion"},
{"_content":"leeuw"}, {"_content":"parkstock"}, {"_content":"masaimara"},
{"_content":"mammals"}
]
},
{"total":3,
"tag":[{"_content":"specanimal"}, {"_content":"animalkingdomelite"},
{"_content":"naturesfinest"}
]}]}, "stat":"ok"}
asked 6 mins ago
Query embedded document in MongoDB
Aucun commentaire:
Enregistrer un commentaire