MongoDb - copy one database to another keeping the users also -
I want to copy from one Mongo DB to another DB on the same server. Mongo version 2.6.0 is 64 bit Windows 64.
I ran the command:
Mongo localhost: 27017 / admin -U & lt; & Gt; -P & lt; & Gt; - Aval "db.copyDatabase ('db_master', 'db_copy1')"
This worked and db_copy1 was created with all users in it. I did db.getUsers () on db_copy1 and returned it to all users. It was all right.
Then I went to copy the database db_copy1 to db_copy2 using the above command (clearly with different database names). But the resulting db_copy2 did not have any users in it.
It is quite easy, so it is possible that I missed something.
Thank you in advance for all your help! Vikram
What I liked about Mongobad is that, just copy the files.
Just go to the directory in that data file and copy them to the dbpit for your new database. If you do not want a fixed database, do not copy the file with that database name!
Comments
Post a Comment