Skip to content

DOCS-7476: Comment on: "manual/reference/method/db.cloneCollection.txt" #2610

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 6 commits 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
3 changes: 3 additions & 0 deletions source/includes/example-clone-collection-text.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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 }``.
8 changes: 8 additions & 0 deletions source/includes/example-clone-collection.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. code-block:: javascript

db.runCommand( { cloneCollection: "users.profiles",
from: "mongodb.example.net:27017",
query: { 'active' : true }
} )

.. include:: /includes/example-clone-collection-text.rst
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
10 changes: 10 additions & 0 deletions source/reference/method/db.cloneCollection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ 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.


.. code-block:: javascript

db.cloneCollection('mongodb.example.net:27017', 'users.profile',
{ 'active' : true } )

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