此处aTrips
具有属性bills
的对象,这些对象引用其他集合数据。我想填充这些数据。
如何填充账单?
let aFleetOwnerTripData = await RegisteredVehicleModel.aggregate(
[ { $match:{clientId:req.user.clientId,"owner_group":{$exists:true}} },
{ $group:{_id:"$owner_group",aVehicle: {$push: "$vehicle_reg_no"},count : {$sum : 1}} },
{ $graphLookup: {
from: "tripv2",
startWith: "$aVehicle",
connectFromField: "aVehicle",
connectToField: "vehicle_no",
as: "aTrips",
restrictSearchWithMatch: {
"clientId" : req.user.clientId,
"statuses":{
$elemMatch:{ status:status, date:{ "$gte": startDate, "$lte": currentDate } }
}
}
} } ]
);