On this page本页内容
db.
copyDatabase
(fromdb, todb, fromhost, username, password, mechanism)¶Deprecated since version 4.0.
Important
Starting in version 4.2, MongoDB removes the copydb
command. The deprecated db.copyDatabase()
, which wraps the copydb
command, can only be run against MongoDB 4.0 or earlier versions. For behavior and examples, refer to the 4.0 or earlier version of the manual.
For an alternative in version 4.2+, see Copy/Clone a Database.
Copies a database either from one mongod
instance to the current mongod
instance or within the current mongod
.
The mongo
shell method db.copyDatabase()
takes the following arguments:
fromdb |
string | Name of the source database. |
todb |
string | Name of the target database. |
fromhost |
string | mongod instance. Omit to copy databases within the same mongod instance. |
username |
string |
For more information, refer to the 4.0 or earlier version of the manual. |
password |
string |
For more information, refer to the 4.0 or earlier version of the manual. |
mechanism |
string |
The
|