The issue is the fact that DocumentSources do not have open/close() like API, but rather doGetNext() only which makes it complicated to do any prepare work. $querySettings is suffering from this, being able to go into infinite recursion because of it.
As part of this ticket we will extend the $queue operator to be able to produce elements by invoking a lambda function instead of taking a collection of documents as input.
This implementation will enable us to rely on this functionality instead of implementing custom solutions as present in:
- https://github.com/10gen/mongo/blob/f22d410b7e06a9462c67eb5d4f8d03c152aa84d2/src/mongo/db/pipeline/document_source_internal_all_collection_stats.cpp#L72
- https://github.com/10gen/mongo/blob/f22d410b7e06a9462c67eb5d4f8d03c152aa84d2/src/mongo/db/pipeline/document_source_internal_shardserver_info.cpp#L61
- https://github.com/10gen/mongo/blob/f22d410b7e06a9462c67eb5d4f8d03c152aa84d2/src/mongo/db/pipeline/document_source_list_cached_and_active_users.cpp#L51
- Any many more (to be investigated)
- is depended on by
-
SERVER-77468 Implement $querySettings agg stage
- Closed
- related to
-
SERVER-77790 Add support for showDebugQueryShape parameter in $querySettings
- Closed