diff options
author | Maria van Keulen <maria@mongodb.com> | 2017-09-20 10:32:34 -0400 |
---|---|---|
committer | Maria van Keulen <maria@mongodb.com> | 2017-09-20 17:35:14 -0400 |
commit | 06e0893491b5f0babf7484ec1c4a6a68109aa081 (patch) | |
tree | f86957fc258ed001a14b67d5beed75db95c7d34e /jstests | |
parent | b5d65df7d3fb641e2904673b804ae8d309f2f8c8 (diff) | |
download | mongo-06e0893491b5f0babf7484ec1c4a6a68109aa081.tar.gz |
SERVER-30933 Change invariant to uassert for invalid uuid in queries
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/commands_with_uuid.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/jstests/core/commands_with_uuid.js b/jstests/core/commands_with_uuid.js index 9b38113a03c..4ce9a789ad9 100644 --- a/jstests/core/commands_with_uuid.js +++ b/jstests/core/commands_with_uuid.js @@ -29,6 +29,7 @@ assert.commandWorked(db.runCommand({insert: mainCollName, documents: [{fooField: 'FOO'}]})); assert.commandWorked(db.runCommand({insert: subCollName, documents: [{fooField: 'BAR'}]})); + // Ensure passing a UUID to find retrieves results from the correct collection. let cmd = {find: uuid}; let res = db.runCommand(cmd); @@ -40,6 +41,13 @@ assert.eq(doc.fooField, 'FOO'); assert(!cursor.hasNext(), 'expected to have exhausted cursor for results ' + tojson(res)); + // Ensure passing a missing UUID to find uasserts that the UUID is not found. + const missingUUID = UUID(); + assert.neq(missingUUID, uuid); + cmd = {find: missingUUID}; + res = db.runCommand(cmd); + assert.commandFailedWithCode(res, ErrorCodes.NamespaceNotFound); + // Ensure passing a UUID to listIndexes retrieves results from the correct collection. cmd = {listIndexes: uuid}; res = db.runCommand(cmd); |