MongoDB $documentNumber
Assign a sequential number within a sorted window.
The number restarts for each partition and follows the order defined by `$setWindowFields`. Use it when every document needs a stable position, including tied sort values.
Window operators calculate across a related, ordered set of documents while keeping each input document in the output stream. They appear in the post-capstone studies.
Course use: Beyond Hard Mode.
Example pipeline syntax
{ $documentNumber: {} }