- Review the data.
What are the data types? What is the structure? What do the values mean? - Build out the query one stage at a time.
- Start with one pipeline operation and a limit operation at the end. Review that you are getting the results you expect. Keep the limit operation in place as you add operations. Verify expected behavior every step of the way.
- Remove the limit operation as the last step .
http://docs.mongodb.org/manual/aggregation/
http://docs.mongodb.org/manual/core/aggregation-pipeline/
http://docs.mongodb.org/manual/reference/operator/aggregation/
This reference includes some nice material regarding comparison with standard SQL operations: http://docs.mongodb.org/manual/reference/sql-aggregation-comparison/
No comments:
Post a Comment