summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2018-12-06 12:05:00 -0500
committerCharlie Swanson <charlie.swanson@mongodb.com>2018-12-07 10:10:20 -0500
commit4b967bc68b65afd145b8b0a98c4868fd217bd14e (patch)
tree3d7ef84cb12a1957719dcc8ed553c9d66873f787 /jstests
parent928ca2478ad8846904f10b789b5220309df732b0 (diff)
downloadmongo-4b967bc68b65afd145b8b0a98c4868fd217bd14e.tar.gz
SERVER-37200 Avoid incorrect $listSessions + $match optimization
(cherry picked from commit d3c939f0fa71118cb7d65296bd449265c52f67eb)
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/list_all_sessions.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/jstests/core/list_all_sessions.js b/jstests/core/list_all_sessions.js
index 02b9cfec297..b507c576417 100644
--- a/jstests/core/list_all_sessions.js
+++ b/jstests/core/list_all_sessions.js
@@ -15,6 +15,10 @@
function listSessions() {
return config.system.sessions.aggregate(pipeline);
}
+ function listSessionsWithFilter(filter) {
+ return config.system.sessions.aggregate(
+ [{'$listSessions': {allUsers: true}}, {$match: filter}]);
+ }
// Start a new session and capture its sessionId.
const myid = assert.commandWorked(admin.runCommand({startSession: 1})).id.id;
@@ -37,6 +41,9 @@
return resultArrayMine.length == 1;
}, "Failed to locate session in collection");
+ const sessionList = listSessionsWithFilter({_id: "non_existent"}).toArray();
+ assert.eq(0, sessionList.length, tojson(sessionList));
+
// Make sure pipelining other collections fail.
assertErrorCode(admin.system.collections, pipeline, ErrorCodes.InvalidNamespace);
})();