标签:查询 lookup detail ocs ber 显示 mongodb user 否则
let pipeline = [{
$lookup: {
from: "user_person",
localField: "cardnumber",
foreignField: "cardnumber",
as: "right_person"
}
},
{"$unwind":"$right_person"},//查处满足条件的子文档
{
$match: {//这儿是将子文档展示出来,否则查处的结果满足子文档的其中之一,子文档的值都会显示出来
"right_person.state":1
}
},
{
$match: {
$or: [{
"IDcard": userIDCard
},
{
"right_person.ownerIDCard": userIDCard
},
{
"right_person.userIDCard": userIDCard
}
]
}
},
// {
// $project:{"inventory_docs.Knowledge_QuestionType":1,"inventory_docs.Knowledge_QuestionDetail":1,"_id":0,"Cat_Name":1} //获取想要的字段
// }
]
标签:查询 lookup detail ocs ber 显示 mongodb user 否则
原文地址:http://www.cnblogs.com/luoliangfei/p/7649675.html