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

Rewrite pushed down match for replaceRoot without $expr

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 8.0.0-rc3
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization
    • Fully Compatible
    • v8.0
    • QO 2024-04-29
    • 135

      Currently, the replaceRoot match pushdown includes a rewritten match expression with an additional {$expr: {$ne: [{$type: ['$subDocument']}, {$const: 'object'}]}} predicate to maintain the invariant that all documents in the collection must have a value at "newField" that resolves to an object. Since a match with $expr can't be pushed down before replaceRoot due to a performance slowdown in converting BSONObj to Document, investigate a non-$expr rewrite alternative.

      The proposed alternative is {$or: [\{"subDocument": {$type: "array"}}, \\{"subDocument": {$not: {$type: "object"}}}]}

            Assignee:
            lynne.wang@mongodb.com Lynne Wang
            Reporter:
            lynne.wang@mongodb.com Lynne Wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: