📌  相关文章
📜  通过 mongo 中对象的子属性查找 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:30.655000             🧑  作者: Mango

代码示例1
db.messages.find( { headers : { From: "reservations@marriott.com" } } )

This queries for documents where headers equals { From: ... }, i.e. contains no other fields.

db.messages.find( { 'headers.From': "reservations@marriott.com" }  )

This only looks at the headers.From field, not affected by other fields contained in, or missing from, headers.