Skip to content

DOCS-1529: copyDB not supported in 2.4 with auth #1238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions source/reference/command/copydb-fields.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
object:
name: copydb
type: dbcommand
field:
optional: true
type: field
name: fromhost
type: string
position: 2
description: |
Hostname of the source :program:`mongod` instance. If omitted,
:dbcommand:`copydb` copies one database to another within a single
MongoDB instance.
---
object:
name: copydb
type: dbcommand
field:
optional: false
type: field
name: fromdb
type: string
position: 3
description: |
Name of the source database.
---
object:
name: copydb
type: dbcommand
field:
optional: false
type: field
name: todb
type: string
position: 4
description: |
Name of the target namespace.
---
object:
name: copydb
type: dbcommand
field:
optional: true
type: field
name: slaveOk
type: boolean
position: 5
description: |
Set ``slaveOK`` to ``true`` to allow :dbcommand:`copydb` to copy data from
secondary members as well as the primary. ``fromhost`` must also be
set.
---
object:
name: copydb
type: dbcommand
field:
optional: true
type: field
name: username
type: string
position: 6
description: |
The username credentials on the ``fromhost`` MongoDB deployment.
---
object:
name: copydb
type: dbcommand
field:
optional: true
type: field
name: nonce
type: string
position: 7
description: |
A one-time password that you request from the remote server using the
:dbcommand:`copydbgetnonce` command.
---
object:
name: copydb
type: dbcommand
field:
optional: true
type: field
name: key
type: string
position: 8
description: |
A hash of the password used for authentication.
...
33 changes: 18 additions & 15 deletions source/reference/command/copydb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ copydb
.. dbcommand:: copydb

The :dbcommand:`copydb` command copies a database from a remote
host to the current host. The command has the following syntax:
host to the current host. :dbcommand:`copydb` accepts the following
options:

.. include:: /reference/command/copydb-fields.rst

:dbcommand:`copydb` has the following syntax:

.. code-block:: javascript

Expand All @@ -20,30 +25,28 @@ copydb
nonce: <nonce>,
key: <key> }

All of the following arguments are optional:

- slaveOk
- username
- nonce
- key

You can omit the ``fromhost`` argument, to copy one database to
another database within a single MongoDB instance.

You must run this command on the destination, or the ``todb``
server.
Behavior
--------

Be aware of the following behaviors:

- :dbcommand:`copydb` can run against a :term:`slave` or a
- :dbcommand:`copydb` cannot be used by users whose privileges
were set with the new :doc:`role-based user documents
</reference/user-privileges/>` that were introduced in 2.4.
To use :dbcommand:`copydb` with access control enabled
you must use the :doc:`legacy user privilege documents
</reference/privilege-documents/>` from v2.2 and prior.

- :dbcommand:`copydb` can run against a :term:`secondary` or a
non-:term:`primary` member of a :term:`replica set`. In this case,
you must set the ``slaveOk`` option to ``true``.

- :dbcommand:`copydb` does not snapshot the database. If the state
of the database changes at any point during the operation, the
resulting database may be inconsistent.

- You must run :dbcommand:`copydb` on the **destination server**.
- You must run :dbcommand:`copydb` on the **destination server**, i.e. the
host receiving the copied data.

- The destination server is not locked for the duration of the
:dbcommand:`copydb` operation. This means that
Expand Down