summaryrefslogtreecommitdiff
path: root/jstests/auth
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2021-07-27 14:02:56 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-27 14:25:04 +0000
commit6078864280613cf9abf901855f09ba03d18a5953 (patch)
tree43282a1dac75e3a2dcf7a4c20d41501f486bffa1 /jstests/auth
parent53078d274792e569f03c6df044edf1d525163452 (diff)
downloadmongo-6078864280613cf9abf901855f09ba03d18a5953.tar.gz
SERVER-58652 Remove legacy ConfigsvrShardCollection command
Diffstat (limited to 'jstests/auth')
-rw-r--r--jstests/auth/list_all_sessions.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/jstests/auth/list_all_sessions.js b/jstests/auth/list_all_sessions.js
index 9ba823564a7..52b48825577 100644
--- a/jstests/auth/list_all_sessions.js
+++ b/jstests/auth/list_all_sessions.js
@@ -15,9 +15,6 @@ function runListAllSessionsTest(mongod) {
const config = mongod.getDB("config");
const pipeline = [{'$listSessions': {allUsers: true}}];
- function listSessions() {
- return config.system.sessions.aggregate(pipeline);
- }
admin.createUser({user: 'admin', pwd: 'pass', roles: jsTest.adminUserRoles});
assert(admin.auth('admin', 'pass'));
@@ -42,7 +39,11 @@ function runListAllSessionsTest(mongod) {
// Ensure that the cache now contains the session and is visible by admin
assert(admin.auth('admin', 'pass'));
- const resultArray = listSessions().toArray();
+ const resultArray =
+ config.system.sessions
+ .aggregate(
+ [{'$listSessions': {allUsers: true}}, {'$sort': {lastUse: -1}}, {'$limit': 1}])
+ .toArray();
assert.eq(resultArray.length, 1);
const cacheid = resultArray[0]._id.id;
assert(cacheid !== undefined);