how to copy a collection from one from another in robomongo
10,053
Another db - another connection. But Robomongo works only with one connection in one period of time. That is why it is impossible.
I suggest you to use mongoimport/mongoexoprt tools for your task. They comes with mongo, are located in same folder as mongod.exe and allows to move collections via databases, by exporting to and importing from a json
file.
Code sample:
mongoexport --db testFrom --port portFrom --username userFrom --password passwordFrom --collection yourCollection --out test.json
mongoimport --db testTo --port portTo --username userTo --password passwordTo --collection yourCollection --file test.json
Author by
Aysha Azura
Updated on June 07, 2022Comments
-
Aysha Azura almost 2 years
I have a collection named dashboard in one db and i want to copy that collection to another db using robomongo. How can i do this? I tried creating a new collection in 2nd db and tried copying but it failed. so somebody please help me
-
Aysha Azura almost 8 yearsNo i trying in different port. the first one runs in port 3001 and other one in port 3003..so how can i copy a collection from port 3001 to port 3003
-
Anton almost 8 yearsIt is not possible you uses 2 different connection(Different port also means that connection is different). Robomongo could not execute queries to 2 different connections in a same time.
-
Waldir J. Pereira Junior over 7 yearsI modifyied the answer to show how to copy a collection between to servers.