Mongodb – Transfering data from one MongoDB server to another while eliminating users/authentication

mongodb

I am transferring MongoDB databases from one server to another. The servers cannot talk to each other, so I must use mongodump/mongorestore. The 'from' server used authentication for the databases. The 'to' server is in a secure environment, so I'd like to completely obliterate any security/authentication features from the database. Is it as simple as just deleting the *users

Best Answer

Yes, just db.system.users.remove({}); for each database.

It seems a bit harder to drop the system.users collection, see: https://jira.mongodb.org/browse/SERVER-4302 but it shouldn't hurt anything if it's empty.

The authentication part is enabled when you run mongod with -auth, so don't put that in your startup script or config file (comment out auth=true, or put auth=false if you're running 2.0+).