0
不知道如何查詢具有以下結構的mongo db對象的匹配directory_object_ids。查詢嵌套Mongo數組
"_id" : ObjectId("5702e52e51c2e40f55b3fd43"),
"_revision" : 4,
"enabled" : true,
"selector" : {
"directory_object_ids" : [
ObjectId("56c4bfb793e0be0eb6297369"),
ObjectId("56c4bfc293e0be0eb6297391"),
ObjectId("56cdfc65f2325d0e6346b7fe")
]
}
我已經試過
db.policies.find({"selector":{"directory_object_ids":{$elemMatch: {$eq:ObjectId("56cdfc65f2325d0e6346b7fe")}}}}).pretty()
和
db.policies.find({"selector":{"directory_object_ids": {$eq:ObjectId("56cdfc65f2325d0e6346b7fe")}}}).pretty()
沒有運氣。
預先感謝您。