{
_id: "joe",
name: "Joe Bookreader",
addresses: [
{
street: "123 Fake Street",
city: "Faketon",
state: "MA",
zip: "12345"
},
{
street: "1 Some Other Street",
city: "Boston",
state: "MA",
zip: "12345"
}
]
}
如果在此文档中存在关键街道,如何找到它?
答案 0 :(得分:2)
您可以使用$ exists operator:
db.yourCollectionName.find( { 'addresses.street': { $exists: true } } );