嗨,我刚接触Mongodb ... 我有一个收藏集,即
{
"_id" : ObjectId("5b5437c1e8c56c92098f684f"),
"name" : "Mongo",
"list" : [
{
"id" : 1,
"author" : "biswa"
},
{
"id" : 2,
"author" : "jack",
"editions" : {
"version" : 8
"version" : 9
}
},
{
"id" : 3,
"author" : "jony"
}
]
}
现在我想查找其id
是列表数组2
的记录。我尝试了db.doc.find({name : "Mongo"},{"list.id" : 2}).pretty()
但它显示了一些不同的输出,即
{
"_id" : ObjectId("5b5437c1e8c56c92098f684f"),
"list" : [
{
"id" : 1
},
{
"id" : 2
},
{
"id" : 3
}
]
}
find
命令将是什么...