News for hackers. Stuff that matters.
Re:Aggregating NBA data, PostgreSQL vs MongoDB by threeseed on Tuesday February 18, 2014 @08:39AM (#7258027)
Probably easier to read if you write it this way:

  db.games.aggregate([
  { $match : { date : { $gt : ISODate("1999-08-01T00:00:00Z"), $lt : ISODate("2000-08-01T00:00:00Z") }}},
  { $unwind : '$teams' },
  { $match : { 'teams.won' : 1 }},
  { $group : { _id : '$teams.name', wins : { $sum : 1 }}},
  { $sort : { wins : -1 }},
  { $limit : 5 }
  ]);

There are no comments on this comment yet.