Guest User

Untitled

a guest
Jul 12th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. db.getCollection('trucks').aggregate([
  2. {
  3. $lookup: {
  4. from: 'loads',
  5. as: 'seats',
  6. localField: '_id',
  7. foreignField: 'truckId',
  8. },
  9. },
  10. {
  11. $project: {
  12. driver: 0,
  13. __v: 0,
  14. },
  15. {
  16. $graphLookup: {
  17. from: < here I just want to use the previous stage's output >,
  18. startWith: "$driverId",
  19. connectFromField: "driverId",
  20. connectToField: "_id",
  21. as: "driver"
  22. }
  23. }
  24. ])
Add Comment
Please, Sign In to add comment