-
Type:
Sub-task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
Fully Compatible
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Overview
Implement the create_document_results_and_metadata host service function, following the same pattern as create_id_lookup. Includes the C API declaration, host adapter implementation, and SDK wrapper. The DPL callback parameter is deferred to M2.
Background
During expand(), an extension calls this host service to construct a $_documentResultsAndMetadata AST node. The extension passes the source stage spec as BSON and the metadata variable name; the host parses it, builds a LiteParsedDocumentResultsAndMetadata, wraps it in a HostAggStageAstNodeAdapter, and returns an AST node handle.
Scope of Work
- api.h: add create_document_results_and_metadata to MongoExtensionHostServicesVTable:
MongoExtensionStatus* (*create_document_results_and_metadata)( MongoExtensionByteView bsonSpec, MongoExtensionByteView metadataVarName, MongoExtensionAggStageAstNode** node); - host_services_adapter.cpp: implement the function — parse bsonSpec into source stage, build LiteParsedDocumentResultsAndMetadata, wrap in HostAggStageAstNodeAdapter, return handle
- SDK (host_services.h): add createDocumentResultsAndMetadata(BSONObj sourceSpec, StringData varName) wrapper on HostServicesAPI
- Note: The DPL callback (MongoExtensionDocResultsDPLCallback) is not included here — it is part of M2.
Acceptance Criteria
- Extension can call createDocumentResultsAndMetadata during expand() and receive a valid AST node handle
- Host correctly builds LiteParsedDocumentResultsAndMetadata from the BSON spec
- Unit tests cover round-trip: extension calls service, host parses, AST node is valid
- depends on
-
SERVER-126006 [Server] Implement $_internalDocumentResultsAndMetadata stage and supporting exec machinery
-
- In Progress
-
- is depended on by
-
SERVER-127286 Modify create_document_results_and_metadata() host service to accept DPL callback
-
- In Progress
-
- is duplicated by
-
SERVER-127861 Generalize HostAggStageAstNodeAdapter clone/promote paths beyond $_idLookup
-
- Closed
-
- related to
-
SERVER-127861 Generalize HostAggStageAstNodeAdapter clone/promote paths beyond $_idLookup
-
- Closed
-