Ignore field order when using JSON Schema to compare object literals

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.6.0-rc0
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Fully Compatible
    • Query 2017-10-02
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Though an uncommon case, it's possible for a user to compare object literals directly using JSON Schema's enum keyword:

      {enum: [{a: 1, b: 1}]}
      

      This will currently use MongoDB's object comparison semantics, which takes field order into account. However, RFC 7159 ยง1 states that:

      An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.

      This implies that $jsonSchema object-to-object comparisons should be done without regard to field order, as JSON Schema adheres to the JSON spec.

            Assignee:
            Kyle Suarez (Inactive)
            Reporter:
            Kyle Suarez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: