当我在集合中使用 $lookup 时,我得到以下错误的输出
这是输出:
{"_pipeline":[{"$project":{"fulldetails":{"$concat":["$associate_name"," ","$associate_no"]},"outlets":"$outl"}},{"$lookup":{"from":"outlets","localField":"_id","foreignField":"associate_id","as":"outl"}}],"options":{}}
Run Code Online (Sandbox Code Playgroud)
这是查询
var data=Associate.aggregate([{
$project: {
"fulldetails": {
$concat: ["$associate_name", " ", "$associate_no"]
},
"outlets": "$outl"
}
}, {
$lookup: {
from: "outlets",
localField: "_id",
foreignField: "associate_id",
as: "outl"
}
}])
Run Code Online (Sandbox Code Playgroud)
提前致谢