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

Make $jsonSchema with dollar fields in all keyword fields reparseable

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 7.3.4, 8.0.0-rc10, 7.0.13
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0
    • Hide

       

      pipeline = [
      {$match: {$jsonSchema: {required: ["a", "b", "$dollarPrefixes"]}}}]

      For the pipeline above, the "required" keyword parses into the following MatchExpression:

      [{
           "$match": {
                "$or":
                     [{[kHashedArrayName]: {"$eq": "?array<?object>"}}]
           },}]

       

      Show
        pipeline = [ {$match: {$jsonSchema: {required: ["a", "b", "$dollarPrefixes"]}}}] For the pipeline above, the "required" keyword parses into the following MatchExpression: [{      "$match": {           "$or":                [{ [kHashedArrayName] : {"$eq": "?array<?object>"}}]      },}]  
    • QO 2024-05-27, QO 2024-06-10, QO 2024-06-24
    • 11

      If $jsonSchema has a property with $[name], the match expression that it is parsed to is not proper bson and is unable to be reparsed, causing errors in query stats (and possibly situations beyond query stats, either now or in the future). As part of SERVER-86945, $jsonSchema commands with "properties" fields containing dollar-prefixed fieldpaths are now reparseable. However, the implementation relies on checking the root of the MatchExpression to see if contains a "$_internalSchema..." child expression, which is not guaranteed for all jsonSchema fields.

      To make all jsonSchema keywords reparseable, we need to find a way to mark parsed and translated jsonSchema expressions as originating from $jsonSchema. We can then skip dollar field validation for those expressions.

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

              Created:
              Updated:
              Resolved: