1

This question has already been asked before, please see this answer: https://stackoverflow.com/a/3011885/212159

The answer is now five years old. This was before the aggregation framework in Mongo existed. Is it now possible to achieve this using the aggregation framework without using nasty workarounds?

Community
  • 1
  • 1
Flukey
  • 6,445
  • 3
  • 46
  • 71
  • Just becasue something is *five years old* does not make it obsolete. If you reasearched as you likely have and found no alternative then it is likely because there is no alternative. The aggregation framework simply does not do "traversal of objects", which is a programatic approach as demonstrated in the mapReduce operations you link to, and therefore what "that" is the solution to what you ask. So this really comes out as a [duplicate question](http://stackoverflow.com/a/3011885/212159) as to the one you know already exists. – Blakes Seven Aug 05 '15 at 02:31

1 Answers1

1

It's not possible with the aggregation framework because the aggregation framework can only do projections and groupings with fields you know. The best way to do this on the database is still MapReduce.

Philipp
  • 67,764
  • 9
  • 118
  • 153