現(xiàn)有數(shù)據(jù)如下
{
"_id" : ObjectId("5992c90beeb45634df1c2be4"),
"name" : "測(cè)試數(shù)據(jù)1",
"status" : {
"product" : [
{
"id" : ObjectId("59a37f7aef887a1d58b59f4f"),
"status" : true
},
{
"id" : ObjectId("59a37f7bef887a1d58b59f50"),
"status" : false
},
{
"id" : ObjectId("59a3801cef887a1d58b59f55"),
"status" : false
}
],
"line":[]
},
"level" : [
{
"id" : ObjectId("59a37efeef887a1d58b59f43"),
"level" : "A"
},
{
"id" : ObjectId("59a37f03ef887a1d58b59f44"),
"level" : "B"
},
{
"id" : ObjectId("59a37f03ef887a1d58b59f45"),
"level" : "C"
}
]
},
{
"_id" : ObjectId("599e7dc07780bbfa9bee42a9"),
"name" : "test數(shù)據(jù)2",
"status" : {
"product" : [
{
"id" : ObjectId("59a37f7aef887a1d58b59f4f"),
"status" : false
},
{
"id" : ObjectId("59a37f7bef887a1d58b59f50"),
"status" : false
},
{
"id" : ObjectId("59a3801cef887a1d58b59f55"),
"status" : false
}
]
},
"location" : 6,
"verify_state" : 0,
"level" : [
{
"id" : ObjectId("59a37efeef887a1d58b59f43"),
"level" : "A"
},
{
"id" : ObjectId("59a37f03ef887a1d58b59f44"),
"level" : "B"
},
{
"id" : ObjectId("59a37f03ef887a1d58b59f45"),
"level" : "C"
}
]
}
......
我希望查找出status.product.id包含在 [ObjectId("59a37f7aef887a1d58b59f4f"),ObjectId("59a37f7bef887a1d58b59f50"),ObjectId("59a3801cef887a1d58b59f55")]數(shù)組里,同時(shí)對(duì)應(yīng)的status.product.status為true的數(shù)據(jù),查詢(xún)語(yǔ)句應(yīng)該怎么寫(xiě)呢?
Mongodb多層嵌套數(shù)組如何更好的查詢(xún)?
開(kāi)心每一天1111
2019-03-16 13:59:25