How to see explan plan of Aggregate?

I have configured the following setting to see the query plan of aggregate operations in the log:
use admin
DB.setLogLevel(5,“command”)
But, I could not see proper execution plan of aggregate query. Can any one help?
Does any aggregate operation use Index ? How can we check detail plan of each operation in aggregate query

Can you show the command you tried
It should be of the form
db.coll.explain().aggregate()
You can declare a pipeline
then use it as
db.coll.explain().aggregate(pipeline)

2 Likes

Thank you for prompt response.
Can you give example of declaring pipeline and use it in aggregate?

There are plenty of examples with the documentation:

https://docs.mongodb.com/manual/core/aggregation-pipeline/

It might be useful to take M121 from MongoDB University. It helped me understand many concepts.

1 Like

Thank you.
This syntax of aggregate is known to me.
Do you know which aggregate functions use IXSCAN?

Sorry, I got the feeling that it was not known to you by

As for

I answered in your other thread.

Hi @Prof_Monika_Shah,

I added a belated response on one of your related discussions:

Regards,
Stennie