Home:ALL Converter>Mongodb aggregation framework performance

Mongodb aggregation framework performance

Ask Time:2019-03-27T13:00:13         Author:Akarsh H S

Json Formatter

I am using mongodb aggregation framework for all the get requests,when i say get request to fetch single document as well as multiple documents.For few requests i have around 90 to 100 stages in my aggregation pipeline($match,$skip,$limit,$lookup,$unwind,$addFields,$group) these are stages what i am maintaining sequentially.If i pass limit more than 50 its giving error like group stage has exceeded the memory limit or else it taking around 60 seconds to execute the query.I my database each and every collection has more than 60,000 documents.How do i resolve this? Does sharding solves my problem?

Author:Akarsh H S,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/55370097/mongodb-aggregation-framework-performance
yy