Skip to content

Commit 73b9e4d

Browse files
authored
DOCSP-24399 colleciton interlink v4.4 (#1788)
* DOCSP-24399 Method interlink backport to v4.4 * DOCSP-24399 Fixes build errors * DOCSP-24399 Fixes build errors * DOCSP-24399 Fixes build errors * DOCSP-24399 Fixes build errors
1 parent c499dc1 commit 73b9e4d

24 files changed

+101
-92
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
.. tip::
3+
4+
In the :program:`mongo` Shell, this command can also be run through the
5+
|method|.
6+
7+
Helper methods are convenient for :program:`mongo` users, but they may not
8+
return the same level of information as database commands. In cases where
9+
the convenience is not needed or the additional return fields are required,
10+
use the database command.
11+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. important:: ``mongo`` Shell Method
2+
3+
This page documents a :binary:`~bin.mongo` method. This is *not*
4+
the documentation for database commands or language-specific drivers,
5+
such as Node.js. To use the database command, see the |dbcommand|.
6+
7+
For MongoDB API drivers, refer to the language-specific
8+
:driver:`MongoDB driver documentation </>`.
9+

source/reference/command/aggregate.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Definition
2020
to process data from a collection or other source with a sequence of
2121
stage-based manipulations.
2222

23+
.. |method| replace:: :method:`db.aggregate()` and
24+
:method:`db.collection.aggregate()` helper methods
25+
.. include:: /includes/fact-dbcommand-tip
26+
2327
Syntax
2428
------
2529

source/reference/command/createIndexes.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Definition
1717

1818
Builds one or more indexes on a collection.
1919

20+
.. |method| replace:: :method:`db.collection.createIndex()` and
21+
:method:`db.collection.createIndexes()` helper methods.
22+
.. include:: /includes/fact-dbcommand-tip
23+
2024
The :dbcommand:`createIndexes` command takes the following form:
2125

2226
.. code-block:: javascript

source/reference/command/distinct.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Definition
2020
an array of the distinct values. The return document also contains
2121
an embedded document with query statistics and the query plan.
2222

23+
.. |method| replace:: :method:`db.collection.distinct()` helper method.
24+
.. include:: /includes/fact-dbcommand-tip
25+
2326
The command takes the following form
2427

2528
.. code-block:: javascript

source/reference/command/dropIndexes.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ dropIndexes
1616
(except the index on the ``_id`` field) from the specified
1717
collection.
1818

19+
.. |method| replace:: :method:`db.collection.dropIndex()` and
20+
:method:`db.collection.dropIndexes()` helper methods.
21+
.. include:: /includes/fact-dbcommand-tip
22+
1923
The command has the following form:
20-
24+
2125
.. code-block:: javascript
2226

2327
{ dropIndexes: <string>, index: <string|document|arrayofstrings>, writeConcern: <document>, comment: <any> }

source/reference/command/explain.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ Definition
2121
:dbcommand:`findAndModify`, :dbcommand:`delete`,
2222
:dbcommand:`mapReduce`, and :dbcommand:`update`.
2323

24-
Although MongoDB provides the :dbcommand:`explain` command, the
25-
preferred method for running :dbcommand:`explain` is to use the
26-
:method:`db.collection.explain()` and :method:`cursor.explain()` helpers.
24+
.. |method| replace:: :method:`db.collection.explain()` and
25+
:method:`cursor.explain()` helper methods
26+
27+
.. include:: /includes/fact-dbcommand-tip
2728

2829
The :dbcommand:`explain` command has the following syntax:
2930

source/reference/command/find.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ Definition
2020
Executes a query and returns the first batch of results and the
2121
cursor id, from which the client can construct a cursor.
2222

23-
.. tip::
24-
25-
Rather than run the :dbcommand:`find` command directly, you can
26-
use the :method:`db.collection.find()` helper provided in the
27-
:binary:`~bin.mongo` shell or the equivalent helper in the
28-
drivers.
23+
.. |method| replace:: :method:`db.collection.find()` or
24+
:method:`db.collection.findOne()` helper methods
25+
.. include:: /includes/fact-dbcommand-tip
2926

3027
Syntax
3128
------

source/reference/command/findAndModify.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ Definition
2424
modifications made on the update. To return the document with the
2525
modifications made on the update, use the ``new`` option.
2626

27+
.. |method| replace:: :method:`db.collection.findAndModify()` helper method
28+
.. include:: /includes/fact-dbcommand-tip
29+
30+
.. versionchanged:: 5.0
31+
2732
The command has the following syntax:
2833

2934
.. code-block:: none

source/reference/command/insert.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Definition
1919
returns a document containing the status of all inserts. The insert
2020
methods provided by the MongoDB drivers use this command internally.
2121

22+
.. |method| replace:: :method:`db.collection.insertOne()` and
23+
:method:`db.collection.insertMany()` helper methods
24+
.. include:: /includes/fact-dbcommand-tip
25+
2226
The command has the following syntax:
2327

2428
.. code-block:: javascript

source/reference/command/listIndexes.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ Definition
1818
Returns information about the indexes on the specified collection. Returned
1919
index information includes the keys and options used to create the index, as
2020
well as :doc:`hidden indexes </core/index-hidden>`. You can optionally set
21-
the batch size for the first batch of results. The
22-
:binary:`~bin.mongo` shell provides the
23-
:method:`db.collection.getIndexes()` helper.
21+
the batch size for the first batch of results.
2422

23+
.. |method| replace:: :method:`db.collection.getIndexes()` helper method
24+
.. include:: /includes/fact-dbcommand-tip
25+
2526
Syntax
2627
------
2728

source/reference/method/db.collection.aggregate.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ Definition
1515

1616
.. method:: db.collection.aggregate(pipeline, options)
1717

18-
19-
.. include:: /includes/fact-mongo-shell-method.rst
20-
18+
.. |dbcommand| replace:: :dbcommand:`aggregate` command
19+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2120

2221
Calculates aggregate values for the data in a collection or a :doc:`view </core/views>`.
2322

24-
2523
.. list-table::
2624
:header-rows: 1
2725
:widths: 20 20 80

source/reference/method/db.collection.createIndex.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ Definition
1717

1818
.. method:: db.collection.createIndex(keys, options, commitQuorum)
1919

20-
21-
.. include:: /includes/fact-mongo-shell-method.rst
22-
20+
.. |dbcommand| replace:: :dbcommand:`createIndexes` command
21+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2322

2423
Creates indexes on collections.
2524

25+
To minimize the impact of building an index on replica sets and
26+
sharded clusters, use a rolling index build procedure as described
27+
on :doc:`/tutorial/build-indexes-on-replica-sets`.
28+
2629
:method:`db.collection.createIndex()` takes the following parameters:
2730

2831
.. list-table::
@@ -141,14 +144,6 @@ Definition
141144

142145
.. versionadded:: 4.4
143146

144-
145-
The :method:`db.collection.createIndex()` is a wrapper around the
146-
:dbcommand:`createIndexes` command.
147-
148-
To minimize the impact of building an index on replica sets and
149-
sharded clusters, use a rolling index build procedure as described
150-
on :doc:`/tutorial/build-indexes-on-replica-sets`.
151-
152147
.. _ensureIndex-options:
153148
.. _createIndex-options:
154149

source/reference/method/db.collection.createIndexes.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ Definition
1515

1616
.. method:: db.collection.createIndexes( [ keyPatterns ], options, commitQuorum )
1717

18-
19-
.. include:: /includes/fact-mongo-shell-method.rst
20-
18+
.. |dbcommand| replace:: :dbcommand:`createIndexes` command
19+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2120

2221
Creates one or more indexes on a collection.
2322

23+
To minimize the impact of building an index on replica sets and sharded
24+
clusters, use a rolling index build procedure
25+
as described on :doc:`/tutorial/build-indexes-on-replica-sets`.
26+
2427
:method:`db.collection.createIndexes()` takes the following
2528
parameters:
2629

@@ -142,14 +145,6 @@ Definition
142145

143146
.. versionadded:: 4.4
144147

145-
146-
The :method:`db.collection.createIndexes()` is a wrapper around the
147-
:dbcommand:`createIndexes` command.
148-
149-
To minimize the impact of building an index on replica sets and sharded
150-
clusters, use a rolling index build procedure
151-
as described on :doc:`/tutorial/build-indexes-on-replica-sets`.
152-
153148
.. _createIndexes-method-options:
154149

155150
Options

source/reference/method/db.collection.distinct.txt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ Definition
1515

1616
.. method:: db.collection.distinct(field, query, options)
1717

18-
19-
.. include:: /includes/fact-mongo-shell-method.rst
20-
18+
.. |dbcommand| replace:: :dbcommand:`distinct` command
19+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2120

2221
Finds the distinct
2322
values for a specified field across a single collection or view and returns
2423
the results in an array.
2524

25+
This method takes the following parameters:
2626

2727
.. list-table::
2828
:header-rows: 1
@@ -57,11 +57,6 @@ Definition
5757
- Optional. A document that specifies the options. See :ref:`distinct-method-options`.
5858

5959

60-
61-
62-
63-
The :method:`db.collection.distinct()` method provides a wrapper
64-
around the :dbcommand:`distinct` command.
6560

6661
.. include:: /includes/note-distinct-bson-limit-agg-alternative.rst
6762

source/reference/method/db.collection.dropIndex.txt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ Definition
1616
.. method:: db.collection.dropIndex(index)
1717

1818

19-
.. include:: /includes/fact-mongo-shell-method.rst
20-
21-
22-
Drops or removes the specified index from a collection. The
23-
:method:`db.collection.dropIndex()` method provides a wrapper around
24-
the :dbcommand:`dropIndexes` command.
19+
.. |dbcommand| replace:: :dbcommand:`dropIndexes` command
20+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2521

22+
Drops or removes the specified index from a collection.
23+
2624
.. note::
2725

2826
- You cannot drop the default index on the ``_id`` field.
@@ -32,6 +30,10 @@ Definition
3230
<db.collection.dropIndex>` to drop all non-``_id`` indexes. Use
3331
:method:`db.collection.dropIndexes()` instead.
3432

33+
To get the index name or the index specification document for the
34+
:method:`db.collection.dropIndex()` method, use the
35+
:method:`db.collection.getIndexes()` method.
36+
3537
The :method:`db.collection.dropIndex()` method takes the following
3638
parameter:
3739

@@ -72,9 +74,6 @@ Definition
7274
:ref:`dropIndex-method-index-builds` for more complete
7375
documentation.
7476

75-
To get the index name or the index specification document for the
76-
:method:`db.collection.dropIndex()` method, use the
77-
:method:`db.collection.getIndexes()` method.
7877

7978
Behavior
8079
--------

source/reference/method/db.collection.dropIndexes.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ Definition
1616

1717
.. method:: db.collection.dropIndexes()
1818

19-
20-
.. include:: /includes/fact-mongo-shell-method.rst
21-
19+
.. |dbcommand| replace:: :dbcommand:`dropIndexes` command
20+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2221

2322
Drops the specified index or indexes (except the index on the
2423
``_id`` field) from a collection.
@@ -102,9 +101,6 @@ Definition
102101
**To drop multiple indexes** (Available starting in MongoDB
103102
4.2), specify an array of the index names.
104103

105-
106-
The :method:`db.collection.dropIndexes()` is a wrapper around the
107-
:dbcommand:`dropIndexes` command.
108104

109105
Behavior
110106
--------

source/reference/method/db.collection.explain.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ Description
1515

1616
.. method:: db.collection.explain()
1717

18-
19-
.. include:: /includes/fact-mongo-shell-method.rst
20-
18+
.. |dbcommand| replace:: :dbcommand:`explain` command
19+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2120

2221
Returns information on the query plan for the following methods:
2322

source/reference/method/db.collection.find.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ Definition
1515

1616
.. method:: db.collection.find(query, projection)
1717

18-
19-
.. include:: /includes/fact-mongo-shell-method.rst
20-
18+
.. |dbcommand| replace:: :dbcommand:`find` command
19+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2120

2221
Selects documents in a collection or view and returns a
2322
:term:`cursor` to the selected documents.
2423

25-
2624
.. list-table::
2725
:header-rows: 1
2826
:widths: 20 20 80

source/reference/method/db.collection.findAndModify.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ Definition
2121

2222
.. method:: db.collection.findAndModify(document)
2323

24-
25-
.. include:: /includes/fact-mongo-shell-method.rst
26-
27-
24+
.. |dbcommand| replace:: :dbcommand:`findAndModify` command
25+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2826

2927
Modifies and returns a single document. By default, the returned
3028
document does not include the modifications made on the update. To
3129
return the document with the modifications made on the update, use
32-
the ``new`` option. The :method:`~db.collection.findAndModify()`
33-
method is a shell helper around the :dbcommand:`findAndModify`
34-
command.
30+
the ``new`` option.
3531

3632
The :method:`~db.collection.findAndModify()` method has the following
3733
form:

source/reference/method/db.collection.findOne.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ Definition
1515

1616
.. method:: db.collection.findOne(query, projection)
1717

18-
19-
.. include:: /includes/fact-mongo-shell-method.rst
20-
18+
.. |dbcommand| replace:: :dbcommand:`find` command
19+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2120

2221
Returns one document that satisfies the specified query criteria on
2322
the collection or :doc:`view </core/views>`. If multiple documents

source/reference/method/db.collection.getIndexes.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ Definition
1616
.. method:: db.collection.getIndexes()
1717

1818

19-
.. include:: /includes/fact-mongo-shell-method.rst
20-
19+
.. |dbcommand| replace:: :dbcommand:`listIndexes` command
20+
.. include:: /includes/fact-mongo-shell-method-alt.rst
2121

2222
Returns an array that holds a list of documents that identify and
2323
describe the existing indexes on the collection, including
24-
:doc:`hidden indexes </core/index-hidden>`. You must call
24+
:doc:`hidden indexes </core/index-hidden>`.
25+
26+
You must call
2527
:method:`db.collection.getIndexes()` on a collection. For example:
2628

2729
.. code-block:: javascript

0 commit comments

Comments
 (0)