How to take backup of MongoDB users and roles without data?

No @chris,

I was restore only system.user collection. I have pasted the commands below,

/mongo_ak/mongodb4_0/bin/mongorestore --port=27018 --db admin --dir=/dump/admin/system.users.bson

You need all of admin to restore that collection successfully.

Why? Users contain roles. So you need roles. The users and roles restore requires the schema version.

All three of those make up the admin database.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.