JSONPointer replaceEscapeChars incorrectly escapes '~'

XMLWordPrintableJSON

    • Query Integration
    • Fully Compatible
    • ALL
    • v8.0, v7.0
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The JSONPointer implementation requires that we escape "~"  and "/" as "~0" and "~1" respectively. Our current implementation incorrectly evaluates "~000" as "~".  Instead, it should evaluate to "~00". 

      Existing tests in json_pointer_test.cpp incorrectly expect this behaviour as well, so the tests should be updated: https://github.com/10gen/mongo/blob/master/src/mongo/db/matcher/schema/json_pointer_test.cpp#L70

      As an example, consider a document:

      { a: { "b~0":

      {...}

      } }

      With the current implementation, it would not be possible to specify a jsonpointer to "b~0" since the escaped string would be: "/a/b~00" which in our impl. would be evaluated as "/a/b~" instead of "/a/b~0"

              Assignee:
              Josh Siegel
              Reporter:
              Santiago Roche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: