Fix BSON ownership in $facet extractRawPipelines

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

      A nested extension pipeline like this

      $unionWith: {from: coll, pipeline: [{$facet: {facetPipe: [{$extensionStage: {}}]}}]}

      throws an invariant (if we remove options.makeSubpipelineOwned) when the extension tries calling getOriginalBson() most likely because DocumentSourceFacet::extractRawPipelines() doesn't make copies and makes the BSON go out of scope.

      We should make $facet handle the BSON properly to avoid making unnecessary makeOwned() calls from the LPP ctor.

            Assignee:
            Unassigned
            Reporter:
            Mariano Shaar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: