MongoDB aggregate vs find performance?
imDifferent
Last updated on
Your thoughts?
Share your thoughts
aggregate() and find() are both popular query methods for returning documents from Mongo.
I would only use aggregate when you have a multi-stage pipeline where records are being matched, filtered, grouped, and projected to create new result sets.
Aggregations allow you to create new fields, find does not.
Aggregations emphasize low number of results for large numbers of entries, find is just regular SELECT.
Aggregations make one call to DB and is usually called once, find makes one call to DB for each time it's invoked.