我想找到匹配的所有文档,例如“conceptID”:“0161-1#01-000001#1”
{
"_id" : ObjectId("59bc0bd77d7934a6a7243f05"),
"definitionID" : "0161-1#DF-000001#1",
"reference" : "FIIG=A23900 INC=62356",
"dummy1" : "",
"dummy2" : "",
"dummy3" : "",
"organisationID" : "0161-1#OG-002462#1",
"languageID" : "0161-1#LG-000001#1",
"statusTerm" : 0,
"definitions" : [
{
"_id" : ObjectId("59bc34a67d7934a6a7c131cc"),
"definitionID" : "0161-1#DF-000001#1",
"conceptID" : "0161-1#01-000001#1",
"definition" : "A metallic claw shaped pivoting item, designed to accelerate the weapon's recovery from recoil by assisting in realigning the breech with the barrel."
}
]
}
我试过这个,但不起作用:find({definitions[0].conceptID: "0161-1#01-000001#1"})
答案 0 :(得分:1)
如果要搜索特定索引,则需要在数组中提供索引,如下所示。
find({"definitions.0.conceptID":"0161-1#01-000001#1"})
否则,对于单键搜索,您可以使用
直接搜索 definitions.conceptID
答案 1 :(得分:0)
.find({definitions: { $elemMatch: {conceptID: "0161-1#01-000001#1"} }})