1

Getting my head around mongo atm. I am trying to copy a complete database from a server to my pc:

db.copyDatabase(fromdb, todb, fromhost)

The fromHost db contains 4 collections with rows in it. For some reason the local version of this db has all the collections but are empty:

db1 0.000GB
db2 0.000GB

What am I missing why are the rows empty?

bier hier
  • 20,970
  • 42
  • 97
  • 166

1 Answers1

0

Q: Why are the rows empty?

A: It looks like something went wrong.

If you haven't already, I would try db.getLastError() to see if there's any error message.

I would also look at this link:

How do I copy a database from one MongoDB server to another?

If you are using --auth, you'll need to include your username/password in there...

Also you must be on the "destination" server when you run the command.

db.copyDatabase(<from_db>, <to_db>, <from_hostname>, <username>, <password>);

If all that doesn't work, you might want to try something like creating a slave of the database you want to copy ...

Finally, review the materials on the MongoDb "copyDatabase" man page:

Please post back with any additional details (e.g. error message).

And, if you get it working, please post back what was wrong, and how you fixed it!

Good luck!

Community
  • 1
  • 1
paulsm4
  • 114,292
  • 17
  • 138
  • 190