我有一个聚合查询,并且像查询中一样使用填充,但是当我使用project删除某些字段时,它不起作用, 看来我在填充文件之前已将其删除
有什么解决办法吗?谢谢
查询
var model = myFirstModel;
var features = featureModel;
model.aggregate([
{ "$match": {
"field1": true,
"field2":true
}},
{
"$project":{
"feature.updatedAt" : 0
}
},
{
$lookup:
{
from: "features",
localField: "_id",
foreignField: "user_id",
as: "user_id"
}
},{ "$unwind": "$user_id" }
])
.exec(function (err, doc) {
features.populate(doc, {path: 'user_id.features.mi_id'}, function(err, populated) {
features.populate(populated, {path: 'user_id.feature.ma_id'}, function(err, populated2) {
callback(populated2)
});
});
})
},