示例数据:
{"_id" : ObjectId("5ca560896208983d3c55b87e"),"createdBy" : {"kind" : "admin","item" : ObjectId("5c9d84c98a007636043f1fe6")}
}
完全匹配嵌套数据进行查询:
db.getCollection('xxxx').find({ "createdBy": { "kind": "admin", "item": ObjectId("5c9d84c98a007636043f1fe6")}})
部分匹配嵌套数据进行查询:
db.getCollection('trainingEntries').find({"createdBy.kind": "admin"})