0

I have different servers with mongoDB in it. What is the best way to clone one collection from one server to another ? I did use mongodump (using Studio 3T) and create a BSON archive of the collection I want to copy on the another server. To do so I did log in as admin of the mongoDB server to copy and created the BSON archive. Then I did login in the other server as admin as well and tried to import the BSON archive but is always end up with : error reading database: not authorized on to execute command. I did add the admin credential of the first server on the second server as well and logged in with the same credentials. What would be the correct way to clone/duplicate a collection from one server to another ?

Thanks

thefwguy
  • 85
  • 1
  • 11
  • 1
    Here is some general info: [How to copy a collection from one database to another in MongoDB](https://stackoverflow.com/questions/11554762/how-to-copy-a-collection-from-one-database-to-another-in-mongodb/63965938#63965938). What is the version of MongoDB you are working with? – prasad_ Oct 09 '20 at 01:53
  • 3.6.1 Looking at the link, thanks – thefwguy Oct 09 '20 at 15:39
  • https://docs.mongodb.com/v4.2/reference/method/db.cloneCollection/ – dılo sürücü Oct 09 '20 at 22:45

1 Answers1

0

I was finally able to clone a db between two servers. Had to play with some user roles, granting roles before not assigned to the user from who created the system. So at least this is solved, now I'm working to actually be able to use the cloned db. Thanks

thefwguy
  • 85
  • 1
  • 11