JSONPointer replaceEscapeChars incorrectly escapes '~'

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • ALL
    • None
    • 3
    • TBD
    • 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:
            Unassigned
            Reporter:
            Santiago Roche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: