Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- db.getCollection('trucks').aggregate([
- {
- $lookup: {
- from: 'loads',
- as: 'seats',
- localField: '_id',
- foreignField: 'truckId',
- },
- },
- {
- $project: {
- driver: 0,
- __v: 0,
- },
- {
- $graphLookup: {
- from: < here I just want to use the previous stage's output >,
- startWith: "$driverId",
- connectFromField: "driverId",
- connectToField: "_id",
- as: "driver"
- }
- }
- ])
Add Comment
Please, Sign In to add comment