Complet list stages names on explain result

Is there some list with all the possible names for stages on explain result?

On documentation https://docs.mongodb.com/v4.4/reference/explain-results/#explain-results just appears:

  • COLLSCAN for a collection scan
  • IXSCAN for scanning index keys
  • FETCH for retrieving documents
  • SHARD_MERGE for merging results from shards
  • SHARDING_FILTER for filtering out orphan documents from shards

What about PROJECTION stage or SORTING stage?

Welcome to the MongoDB Community Forums @Jonathan_Alcantara !

The list of possible stages will vary by MongoDB server version and type of query you are explaining, but the most complete list (including some internal stages you may never see in explain output) would be in the source code, eg: https://github.com/mongodb/mongo/blob/master/src/mongo/db/query/stage_types.h#L49

There are also a few stages specific to sharded explain: https://github.com/mongodb/mongo/blob/master/src/mongo/s/commands/cluster_explain.cpp#L45

The documentation mentions some of the common stages but does not attempt to be an exhaustive list as the notion is that the stages should be “human-readable”.

If there are specific stages you would like to learn more about in the context of explain results, please share your explain output.

Regards
Stennie

Thanks for your reply.
I did that post because on the certification exam I had a question where I had select from a list of responses all the correct stages of the explain output.

My surprise was that I didn’t found a list of all that stages on the documentation.

Is a bit strange that the only place with a complete list is on source code.

Thanks to that I guess that I failed that question on the exam.

Hi @Jonathan_Alcantara,

Thank you for providing additional context.

The certification exam questions should only cover information that is included in the documentation and University courses, however I will pass your feedback on to the team so they can review any relevant cert questions about aggregation stages in the explain output.

Regards,
Stennie

Hi, I have the same question in the November certification exam. I believe the SORT stage should be available in the output of explain if the query plan can not use an index for sorting. However, I’m not sure if PROJECTION is a correct answer to that exam question. I selected that option of PROJECTION in the exam because I found this stage in the next question showing the output of a explain.

@Stennie For mongo 5 version what are complete number of stages, certification wise? Still it is not settled.