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.
- depends on
-
SERVER-30176 Extend the JSON Schema parser to handle logical restriction keywords
- Closed