Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. var a = db.Match.aggregate( [
  2. {
  3. $addFields: {
  4. total_goal: { $add: [ "$home_team_goal", "$away_team_goal" ] }
  5. }
  6. },
  7. { $sort : { total_goal : -1} },
  8. { $project : { total_goal: 1 } },
  9. { $limit : 1 }
  10. ])
  11.  
  12. db.Match.find(
  13. {
  14. $expr:{$eq : [{$add: [ "$home_team_goal", "$away_team_goal" ]}, "a.total_goal"]}
  15. }
  16. );
  17.  
  18.  
  19. a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement