无法理解查询此 mongo 文档的特定语法。我只想获得(项目?)u =“123”的“条目”。我尝试过这样的事情:
db["conv_msgs_822"].aggregate({$match: {"_id": "1234", "entries.$.u" : "123"}})
哪个失败了。这甚至可能吗?
{
"_id" : "1234",
"entries" : {
"1" : {
"body" : "aesf asdf asdf asdf asdf",
"u" : "123"
},
"2" : {
"body" : "1234",
"u" : ""
},
"3" : {
"body" : "some other body ",
"u" : "14"
},
"4" : {
"body" : "another body",
"u" : "123"
}
}
}