daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top