diff options
author | Justin Seyster <justin.seyster@mongodb.com> | 2020-08-07 10:32:27 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-07 15:59:01 +0000 |
commit | 8c2d241c4bdd4273b7f963ae07095513e94fec00 (patch) | |
tree | abc67e8e9c77cbc17ac830f4a02e770e8b44d2a1 | |
parent | 6746a870682896490e7f002f01c21e0ee631b230 (diff) | |
download | mongo-8c2d241c4bdd4273b7f963ae07095513e94fec00.tar.gz |
SERVER-48244 Fix linter error
-rw-r--r-- | jstests/core/explain_find.js | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/jstests/core/explain_find.js b/jstests/core/explain_find.js index 0d9e1eef95b..cb74985ac87 100644 --- a/jstests/core/explain_find.js +++ b/jstests/core/explain_find.js @@ -1,47 +1,48 @@ // Tests for explaining find through the explain command. (function() { -"use strict"; - -var collName = "jstests_explain_find"; -var t = db[collName]; -t.drop(); - -t.ensureIndex({a: 1}); - -for (var i = 0; i < 10; i++) { - t.insert({_id: i, a: i}); -} - -var explain = - db.runCommand({explain: {find: collName, filter: {a: {$lte: 2}}}, verbosity: "executionStats"}); -printjson(explain); -assert.commandWorked(explain); -assert.eq(3, explain.executionStats.nReturned); - -explain = db.runCommand( - {explain: {find: collName, min: {a: 4}, max: {a: 6}}, verbosity: "executionStats"}); -printjson(explain); -assert.commandWorked(explain); -assert.eq(2, explain.executionStats.nReturned); - -// Compatibility test for the $explain OP_QUERY flag. This can only run if find command is disabled. -if (!db.getMongo().useReadCommands()) { - var explain = t.find({$query: {a: 4}, $explain: true}).limit(-1).next(); - assert("queryPlanner" in explain); - assert("executionStats" in explain); - assert.eq(1, explain.executionStats.nReturned); - assert("allPlansExecution" in explain.executionStats); -} - -// Invalid verbosity string. -let error = assert.throws(function() { - t.explain("foobar").find().finish(); -}); -assert.commandFailedWithCode(error, ErrorCodes.FailedToParse); - -error = assert.throws(function() { - t.find().explain("foobar"); -}); -assert.commandFailedWithCode(error, ErrorCodes.FailedToParse); + "use strict"; + + var collName = "jstests_explain_find"; + var t = db[collName]; + t.drop(); + + t.ensureIndex({a: 1}); + + for (var i = 0; i < 10; i++) { + t.insert({_id: i, a: i}); + } + + var explain = db.runCommand( + {explain: {find: collName, filter: {a: {$lte: 2}}}, verbosity: "executionStats"}); + printjson(explain); + assert.commandWorked(explain); + assert.eq(3, explain.executionStats.nReturned); + + explain = db.runCommand( + {explain: {find: collName, min: {a: 4}, max: {a: 6}}, verbosity: "executionStats"}); + printjson(explain); + assert.commandWorked(explain); + assert.eq(2, explain.executionStats.nReturned); + + // Compatibility test for the $explain OP_QUERY flag. This can only run if find command is + // disabled. + if (!db.getMongo().useReadCommands()) { + var explain = t.find({$query: {a: 4}, $explain: true}).limit(-1).next(); + assert("queryPlanner" in explain); + assert("executionStats" in explain); + assert.eq(1, explain.executionStats.nReturned); + assert("allPlansExecution" in explain.executionStats); + } + + // Invalid verbosity string. + let error = assert.throws(function() { + t.explain("foobar").find().finish(); + }); + assert.commandFailedWithCode(error, ErrorCodes.FailedToParse); + + error = assert.throws(function() { + t.find().explain("foobar"); + }); + assert.commandFailedWithCode(error, ErrorCodes.FailedToParse); }());
\ No newline at end of file |