Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. db.actions.aggregate([
  2. {
  3. '$unwind': '$actorId'
  4. },
  5. {
  6. $lookup: {
  7. from: 'actors',
  8. localField: 'actorId',
  9. foreignField: '_id',
  10. as: 'actor'
  11.  
  12. }
  13. },
  14. {
  15. '$unwind': '$actor'
  16. }
  17. ]);
  18.  
  19. db.actors.aggregate(/* how can I get actions? */);
  20.  
  21. db.actors.aggregate([
  22. {
  23. $lookup: {
  24. from: 'actions',
  25. localField: '_id',
  26. foreignField: 'actorid',
  27. as: 'actions'
  28. }
  29. }
  30. ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement