Skip to content

Commit 414738f

Browse files
author
Andrew Leung
committed
adding in links for shell helpers
1 parent 6f2ee44 commit 414738f

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

draft/tutorial/copy-database.txt

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@ Considerations
4040
- You can run :dbcommand:`copydb` or :dbcommand:`clone` commands on a
4141
:term:`secondary` member.
4242

43-
- There must be enough free disk storage on the destination server for the
44-
database from the source server. You can check for the size of the
45-
database on the source server by issuing command:
46-
47-
.. code-block::
48-
49-
db.runCommand()
43+
- There must be enough free disk storage on the destination server for
44+
the database from the source server. Use the ``db.stats()`` function
45+
to check the size of the database on the source :program:`mongod`
46+
instance. For more information on ``db.stats()`` see the
47+
:doc:`database statistics </reference/database-statistics>` section.
5048

5149
Process
5250
-------
5351

5452
Copy a Database to Another Server
5553
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5654

57-
Use the :dbcommand:`copydb` command to transfer a database from
58-
one MongoDB instance to another, such as from a development instance
59-
to a production instance.
55+
Use the :dbcommand:`copydb` command to transfer a database from one
56+
MongoDB instance to another, such as from a development instance to a
57+
production instance. The :func:`db.copyDatabase()` helper in the
58+
:program:`mongo` shell provides a wrapper around the
59+
:dbcommand:`copydb`.
6060

6161
This is useful when you want to move a database from the development
62-
environment to the production environment, or create a remote-branch of the database
63-
to archive the current database on a different server.
62+
environment to the production environment, or create a remote-branch
63+
of the database to archive the current database on a different server.
6464

6565
To copy the database named ``test`` on server ``db0.example.net`` to
6666
another server ``db1.example.net`` renaming it ``records`` in the process.
@@ -83,7 +83,9 @@ Rename a Database
8383
Use the :dbcommand:`copydb` command to copy a database within the same
8484
server also renaming the database. This is useful when the contents of
8585
the database has changed from the initial naming of the database and a
86-
new name would be more appropriate.
86+
new name would be more appropriate. The :func:`db.copyDatabase()`
87+
helper in the :program:`mongo` shell provides a wrapper around the
88+
:dbcommand:`copydb`.
8789

8890
To rename a database from ``test`` to ``records`` within the
8991
same server, ``db1.example.net``.
@@ -104,7 +106,9 @@ If the source server requires ``username`` and ``password``, you can
104106
include these parameters in the :dbcommand:`copydb` command. This is
105107
useful where you need to create offsite backups, a local development
106108
system which has data from the production system, or create a system
107-
to produce reports.
109+
to produce reports. The :func:`db.copyDatabase()` helper in the
110+
:program:`mongo` shell provides a wrapper around the
111+
:dbcommand:`copydb`.
108112

109113
To copy ``test`` to ``records`` from the source server
110114
``db0.example.net``, which requires ``username`` and ``password``
@@ -122,11 +126,12 @@ authentication, to ``db1.example.net`` use the following procedure.
122126
Clone a Database
123127
~~~~~~~~~~~~~~~~
124128

125-
The :dbcommand:`clone` command copies a database between :program:`mongod`
126-
instances; however, :dbcommand:`clone` preserves the database
127-
name on the destination server. For many operations,
129+
The :dbcommand:`clone` command copies a database between
130+
:program:`mongod` instances; however, :dbcommand:`clone` preserves the
131+
database name on the destination server. For many operations,
128132
:dbcommand:`clone` has identical functionality and a simpler syntax
129-
than :dbcommand:`copydb`.
133+
than :dbcommand:`copydb`. The :func:`db.cloneDatabase()` helper in the
134+
:program:`mongo` shell provides a wrapper around :dbcommand:`clone`.
130135

131136
To clone a database from ``db0.example.net`` to ``db1.example.net``, on
132137
``db1.example.net`` follow these procedures.

0 commit comments

Comments
 (0)