Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-103802

Make namespaces more clear in ExpressionContext and surrounding code

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

      The ExpressionContext holds information about a bunch of different namespaces, like the user-provided namespace, the execution namespace, and any secondary involved namespaces. Reading the code, the distinction between each of those members is not clear. This ticket should improve this.

      ------------------------------

      More details:

      The resolved namespaces stored on the ExpressionContext are intended to hold information about the secondary namespaces involved in a query (for example, namespaces of $lookup or $unionWith subpipelines) but not the primary namespace. This is particularly evident by this function:

      bool noForeignNamespaces() const {
          return _params.resolvedNamespaces.empty();
      } 

      Elsewhere, that distinction is not clear. The code and surrounding documentation should be improved to make that obvious to readers.

      Additionally, it would be helpful to change ns in ExpressionContext to be executionNss to better represent what the member variable holds. Please note that making this change in both ExpressionContext and ExpressionContextBuilder requires trivial updates in ~100 files (i.e. will require a lot of reviews across teams). 

            Assignee:
            josh.siegel@mongodb.com Josh Siegel
            Reporter:
            will.buerger@mongodb.com Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: