diff options
author | Kyle Suarez <kyle.suarez@mongodb.com> | 2017-09-20 14:31:17 -0400 |
---|---|---|
committer | Kyle Suarez <kyle.suarez@mongodb.com> | 2017-09-20 14:31:17 -0400 |
commit | 7a15db88968b9f6dd4418f4a89a2826c82b2ecac (patch) | |
tree | 7ee7b58ac2ace0609561c3c1467c0dded2753a5e /jstests | |
parent | 77bbdee3f8b59b1e070129616360f87e190a540b (diff) | |
download | mongo-7a15db88968b9f6dd4418f4a89a2826c82b2ecac.tar.gz |
SERVER-30695 uniqueItems must ignore field order when comparing documents
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/json_schema/unique_items.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/jstests/core/json_schema/unique_items.js b/jstests/core/json_schema/unique_items.js index f94fb5546d8..08c8ae84211 100644 --- a/jstests/core/json_schema/unique_items.js +++ b/jstests/core/json_schema/unique_items.js @@ -41,10 +41,8 @@ assertSchemaMatch(coll, schema, {a: [{a: 1}, {a: 1}]}, false); assertSchemaMatch(coll, schema, {a: [[1, 2], [1, 2]]}, false); assertSchemaMatch(coll, schema, {a: [null, null]}, false); - - // TODO (SERVER-30695): uniqueItems should compare objects in a field order-insensitive way when - // testing for uniqueness. - assertSchemaMatch(coll, schema, {a: [{x: 1, y: 1}, {y: 1, x: 1}]}, true); + assertSchemaMatch(coll, schema, {a: [{x: 1, y: 1}, {y: 1, x: 1}]}, false); + assertSchemaMatch(coll, schema, {a: [{x: [1, 2], y: "a"}, {y: "a", x: [1, 2]}]}, false); // Test that {uniqueItems: false} has no effect. schema = {properties: {a: {uniqueItems: false}}}; @@ -60,4 +58,6 @@ assertSchemaMatch(coll, schema, {a: [{a: 1}, {a: 1}]}, true); assertSchemaMatch(coll, schema, {a: [[1, 2], [1, 2]]}, true); assertSchemaMatch(coll, schema, {a: [null, null]}, true); + assertSchemaMatch(coll, schema, {a: [{x: 1, y: 1}, {y: 1, x: 1}]}, true); + assertSchemaMatch(coll, schema, {a: [{x: [1, 2], y: "a"}, {y: "a", x: [1, 2]}]}, true); }()); |