summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
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);
})();