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: mongo/stage_types.h at master · mongodb/mongo · GitHub

There are also a few stages specific to sharded explain: mongo/cluster_explain.cpp at master · mongodb/mongo · GitHub

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_X For mongo 5 version what are complete number of stages, certification wise? Still it is not settled.