Implement Host::AggregationStageAstNode

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In order to restrict the usage of $_internalSearchIdLookup, we will only allow extensions to desugar into an $idlookup if they generate an AstNode directly from the Host which can be later parsed into a DocumentSource.

      We need to implement a host::AstNode which can be allocated by the Host and passed to extensions to use in their expansion. 
      1. Implement host::AggregationStageAstNode, which is an implementation of MongoExtensionAggregationStageAstNode
      2. add a static function to host::AggregationStageAstNode, which checks that a generic MongoExtensionAggregationStageAstNode is a host::AggregationStageAstNode which was allocated by the host. This can be done by checking the vtable.
      3. host::AggregationStageAstNode should wrap a BSONObj which holds an aggregation stage specification.

      4. host::AggregationStageAstNode should implement a getter to obtain the BSON spec. 

      BSONObj host::AggregationStageAstNode::getIdLookupSpec() { return _spec.getOwned; }

      5. implement handles to this type of AstNode in the C++ SDK.
      6. Implement unit testing.

      Implementation notes:

      The end goal here is that the extension will call a function in the API to allocate an IdLookup AstNode. The host will return a host::AggregationStageAstNode which holds a unique_ptr<LiteParsedDocumentSource> OR a unique_ptr<LiteParsedDocumentSourceIdLookup>. If we choose to keep an LiteParsedDocumentSourceIdLookup directly, it makes the current code simpler, but we may need to adapt it in the future if we want to support generating more AstNode types by the Host.

      LiteParsedDocumentSourceIdLookup should keep the original BSON spec. host::AggregationStageAstNode should have a public method that allows exposing the BSON spec:

      BSONObj host::AggregationStageAstNode::getIdLookupSpec() {
         return _liteParsedIdLookup->getBsonSpec();
      }

       

            Assignee:
            Adithi Raghavan
            Reporter:
            Santiago Roche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: