|
MongoDB includes commands for copying a database from one server to another. // copy an entire database from one name on one server to another // name on another server. omit <from_hostname> to copy from one // name to another on the same server. db.copyDatabase(<from_dbname>, <to_dbname>, <from_hostname>); // if you must authenticate with the source database db.copyDatabase(<from_dbname>, <to_dbname>, <from_hostname>, <username>, <password>); // in "command" syntax (runnable from any driver): db.runCommand( { copydb : 1, fromdb : ..., todb : ..., fromhost : ... } ); // command syntax for authenticating with the source: n = db.runCommand( { copydbgetnonce : 1, fromhost: ... } ); db.runCommand( { copydb : 1, fromhost: ..., fromdb: ..., todb: ..., username: ..., nonce: n.nonce, key: <hash of username, nonce, password > } ); // clone the current database (implied by 'db') from another host var fromhost = ...; print("about to get a copy of database " + db + " from " + fromhost); db.cloneDatabase(fromhost); // in "command" syntax (runnable from any driver): db.runCommand( { clone : fromhost } ); |

IF YOU HAVE A QUESTION, POST IT TO THE USER GROUP.
These pages are fine for comments, but for questions, your best bet will always be the MongoDB User Group. blog comments powered by Disqus