Hi i am new to Mongodb... I have a collection i.e.
{
"_id" : ObjectId("5b5437c1e8c56c92098f684f"),
"name" : "Mongo",
"list" : [
{
"id" : 1,
"author" : "biswa"
},
{
"id" : 2,
"author" : "jack",
"editions" : {
"version" : 8
"version" : 9
}
},
{
"id" : 3,
"author" : "jony"
}
]
}
Now i want find record whose id
is 2
of list array..i tried db.doc.find({name : "Mongo"},{"list.id" : 2}).pretty()
but it shows some different output i.e.
{
"_id" : ObjectId("5b5437c1e8c56c92098f684f"),
"list" : [
{
"id" : 1
},
{
"id" : 2
},
{
"id" : 3
}
]
}
what will be the find
command for this...