Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 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
9 changes: 9 additions & 0 deletions source/includes/example-clone-collection.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. code-block:: javascript
{ cloneCollection: "users.profiles",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make this a functioning example by surrounding it wiht

db.runCommand( { ... } )

from: "mongodb.example.net:27017",
query: { active: true } }
This operation copies the ``profiles`` collection from the ``users``
database on the server at ``mongodb.example.net``. The operation only
copies documents that satisfy the query ``{ active: true }``.
3 changes: 3 additions & 0 deletions source/includes/extracts-cloneCollection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ ref: _cloneCollection-behavior
content: |
:program:`mongos` does not support {{cloneCollection}}.

{{cloneCollection}} cannot be used if the `from` server has
:doc:`authorization </core/authorization>` enabled.

.. versionchanged:: 3.0

If the given :term:`namespace` already exists in the destination
Expand Down
10 changes: 1 addition & 9 deletions source/reference/command/cloneCollection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,4 @@ Behavior
Example
-------

.. code-block:: javascript

{ cloneCollection: "users.profiles",
from: "mongodb.example.net:27017",
query: { active: true } }

This operation copies the ``profiles`` collection from the ``users``
database on the server at ``mongodb.example.net``. The operation only
copies documents that satisfy the query ``{ active: true }``.
.. include:: /includes/example-clone-collection.rst
5 changes: 5 additions & 0 deletions source/reference/method/db.cloneCollection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ Behavior
--------

.. include:: /includes/extracts/cloneCollection-behavior-method.rst

Example
-------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry -- just saw this single sourcing. We're showing the command example instead of the method example here. I don't think we can single source this.


..include:: /includes/example-clone-collection.rst