Will mongo cache big aggregation query?

If a write a really long aggregation pipeline in my application, will the aggregation pipeline itself be transferred to mongodb on each .aggregate() call, or is the query itself cached?

Hi @Alex_Bjorlig

We do cache the plans of a query, however to compare a cache on the server we need to receive the aggregation pipeline to the server.

If you want to avoid that and the pipeline code is static you can use a view to define it.


Ok thanks @Pavel_Duchovny - in my case it’s not static so I will not use a view then.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.