MongoDB Sharding config.system.session collection

Hi all,

Im using MongoDB 5.0 shard setup. In the shard servers, we are not seeing ‘system.session’ collection from the config db.

And we are facing issue with the ‘logicalSessionRecordCache’, which are not getting cleared automatically. Once it reach its limit, we are not able to access any of the mongodb servers.

Kindly suggest a fix to recreate this ‘system.session’ collection on this shard setup.

You have to create this collection in every shard in your MongoDB cluster
for that, you create a user with __system role (root user can’t create this collection)
after creating that user with

db.createUser({ user: “test”, pwd: “xxx”, roles: [ “__system” ] })

you can simply connect to your shards with that user and run these commands:

use config
db.createCollection(“system.sessions”)