Support internal-only extension stages

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

      Extension stages that must be serialized over the wire need a stage descriptor, and consequently, a parse node so that a shard knows how to process a stage sent from mongos. Some extension stages should be marked as internal-only if we forbid them from being specified in user pipelines (e.g. $setMetadata, $_internalSearchIdLookup.

      Currently, all extension stages can be specified in a user pipeline since we don't put any restrictions on AllowedWithClientType (checked during LiteParsed validation). We should stages to be able to specify whether they are internal-only, probably in the stage descriptor.

      Ideally, we also shouldn't be querying an internal-only stage for its query shape or trying to expand it, so the current flow of Descriptor -> ParseNode -> AstNode is somewhat misleading for internal-only stages. It would be nice if we could express these as AstNodes only, but extension stage registration currently requires a stage descriptor which knows how to parse given a BSON spec. It could be worthwhile to investigate if it's possible to register using an AstNode instead of a stage descriptor, or perhaps less invasively, allow descriptor.parse() to return an AstNode instead of just a ParseNode so that we can maintain current stage description behavior without materializing an unnecessary ParseNode.

            Assignee:
            Unassigned
            Reporter:
            Lynne Wang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: