O'Reilly logo
  • Minoru Mizutani thinks this is interesting:

db.reviews.aggregate({$group: {_id: "customer"}}, {$out: "customer_mapping"})

From

Cover of Building a Recommendation Engine with Scala

Note

Beware the typo here! Don't forget to prepend $ to customer:
db.reviews.aggregate([{$group: {_id: "$customer"}}, {$out: "customer_mapping"}])