Aggregation pipelines in MongoDB can get very complex very quickly. But they provide a much more flexible query interface than simple “find” queries and often allow you to leverage data locality by moving much of your data processing to Mongo itself. In this blog post, …