Files
mongo/jstests/core/explain_db_mismatch.js
2017-06-19 19:02:31 -04:00

8 lines
287 B
JavaScript

// Ensure that explain command errors if the inner command has a $db field that doesn't match the
// outer command.
(function() {
assert.commandFailedWithCode(
db.runCommand({explain: {find: 'some_collection', $db: 'not_my_db'}}),
ErrorCodes.InvalidNamespace);
}());