SHARE
TWEET

Untitled

a guest Jun 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [{_id: 1, groupId: 10},
  2.  {_id: 2, groupId: 20}]
  3.      
  4. [{_id: 1, groupId: 10, userData: 'A'},
  5.  {_id: 2, groupId: 10, userData: 'B'}]
  6.      
  7. [{_id: 1, groupId: 20, userData: 'C'},
  8.  {_id: 2, groupId: 20, userData: 'D'}]
  9.      
  10. $lookup: {
  11.     from: {
  12.         $cond: [{
  13.                 $eq: ['$groupId', 10]
  14.             },
  15.             'group10',
  16.             'group20'
  17.         ]
  18.     },
  19.     localField: 'groupId',
  20.     foreignField: 'groupId',
  21.     as: 'data'
  22. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top