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: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization
    • ALL
    • 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
    • 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:
            6 Start watching this issue

              Created:
              Updated: