Skip to content

Commit c80ad63

Browse files
authored
DOCSP 25472 collection interlink ii (#1961) (#2127)
* DOCSP-25472 db.collection.isCapped * DOCSP-25472 db.collection.latencyStats * DOCSP-25472 db.collection.reIndex * DOCSP-25472 collection interlink * DOCSP-25472 collection interlink * DOCSP-25472 collection interlink * DOCSP-25472 collection interlink * DOCSP-25472 delete and update commands * DOCSP-25472 delete and update commands * DOCSP-25472 Adds mongosh interlink * DOCSP-25472 Adds mongosh interlink * DOCSP-25472 Fixes interlink to command * DOCSP-25472 Updates command tip * DOCSP-25472 Updates command tip * DOCSP-25472 Updates command tip * DOCSP-25472 Fixes build error * DOCSP-25472 Self-review fixes * DOCSP-25472 Self-review fixes * DOCSP-25472 Self-review fixes * DOCSP-25472 Fixes per Dave Cuthbert * DOCSP-25472 Fixes per Dave Cuthbert * DOCSP-25472 Fixes per Dave Cuthbert * DOCSP-25472 Fixes per Dave Cuthbert * DOCSP-25472 Fixes per Anna * DOCSP-25472 Fixes per Anna
1 parent 77f267d commit c80ad63

38 files changed

+125
-110
lines changed

source/includes/fact-mongosh-shell-method-alt.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
This page documents a :binary:`~bin.mongosh` method. This is *not*
44
the documentation for database commands or language-specific drivers,
5-
such as Node.js. To use the database command, see the |dbcommand|.
5+
such as Node.js.
6+
7+
For the database command, see the |dbcommand|.
68

79
For MongoDB API drivers, refer to the language-specific
810
:driver:`MongoDB driver documentation </>`.

source/reference/command/aggregate.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ 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
23+
.. |method| replace:: :method:`db.aggregate` and
24+
:method:`db.collection.aggregate` helper methods or with the
25+
:method:`~db.collection.watch` helper method
2526
.. include:: /includes/fact-dbcommand-tip
2627

2728
Syntax
@@ -51,13 +52,6 @@ The command has the following syntax:
5152
}
5253
)
5354

54-
.. tip::
55-
56-
Rather than run the :dbcommand:`aggregate` command directly, most
57-
users should use the :method:`db.collection.aggregate()` helper
58-
provided in :binary:`~bin.mongosh` or the equivalent helper in
59-
their driver.
60-
6155
Command Fields
6256
~~~~~~~~~~~~~~
6357

source/reference/command/collMod.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Definition
1818
:dbcommand:`collMod` makes it possible to add options to a collection
1919
or to modify view definitions.
2020

21+
.. |method| replace:: :method:`~db.collection.hideIndex` and
22+
:method:`~db.collection.unhideIndex` helper methods
23+
.. include:: /includes/fact-dbcommand-tip
24+
2125
.. note::
2226

2327
The view modified by this command does not refer to materialized
@@ -103,11 +107,6 @@ Index Options
103107
Modifying the index option ``hidden`` resets the
104108
:pipeline:`$indexStats` for the index if the value changes.
105109

106-
.. seealso::
107-
108-
- :method:`db.collection.hideIndex()`
109-
- :method:`db.collection.unhideIndex()`
110-
111110
.. versionadded:: 4.4
112111

113112
* - ``prepareUnique``
@@ -165,8 +164,6 @@ Index Options
165164
.. seealso::
166165

167166
- :ref:`index-type-hidden`
168-
- :method:`db.collection.hideIndex()`
169-
- :method:`db.collection.unhideIndex()`
170167

171168
Document Validation
172169
~~~~~~~~~~~~~~~~~~~

source/reference/command/collStats.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ Definition
1818
The :dbcommand:`collStats` command returns a variety of storage statistics
1919
for a given collection.
2020

21+
.. |method| replace:: :method:`~db.collection.stats` helper method.
22+
Specific fields in the ``collStats`` output can be accessed using the
23+
:method:`~db.collection.dataSize`,
24+
:method:`~db.collection.estimatedDocumentCount`,
25+
:method:`~db.collection.isCapped`,
26+
:method:`~db.collection.latencyStats`,
27+
:method:`~db.collection.storageSize`,
28+
:method:`~db.collection.totalIndexSize`, and
29+
:method:`~db.collection.totalSize`
30+
helper methods
31+
.. include:: /includes/fact-dbcommand-tip
32+
2133
.. |command| replace:: ``collStats``
2234

2335
.. include:: /includes/fact-dbcommand.rst

source/reference/command/count.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Definition
1818
Counts the number of documents in a collection or a view. Returns a
1919
document that contains this count and as well as the command status.
2020

21+
.. |method| replace:: :method:`~db.collection.count` helper method
22+
.. include:: /includes/fact-dbcommand-tip
23+
2124
.. note::
2225

2326
MongoDB drivers compatible with the 4.0 features deprecate their
@@ -139,13 +142,6 @@ Command Fields
139142
.. versionadded:: 4.4
140143

141144

142-
143-
:binary:`~bin.mongosh` also provides the following wrapper methods for :dbcommand:`count`:
144-
145-
- :method:`~cursor.count()`
146-
- :method:`db.collection.estimatedDocumentCount()`
147-
- :method:`db.collection.count()`
148-
149145
Stable API Support
150146
------------------
151147

source/reference/command/delete.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ Definition
2323

2424
.. versionchanged:: 5.0
2525

26+
.. |method| replace:: :method:`~db.collection.deleteOne`,
27+
:method:`~db.collection.deleteMany`, and
28+
:method:`~db.collection.findOneAndDelete`
29+
helper methods
30+
.. include:: /includes/fact-dbcommand-tip
31+
2632
:returns:
2733

2834
A document that contains the status of the operation.

source/reference/command/drop.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Definition
1818
The :dbcommand:`drop` command removes an entire collection from a
1919
database.
2020

21+
.. |method| replace:: :method:`~db.collection.drop` helper method
22+
.. include:: /includes/fact-dbcommand-tip
23+
2124
Syntax
2225
------
2326

source/reference/command/mapReduce.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Definition
2222
The :dbcommand:`mapReduce` command allows you to run
2323
:term:`map-reduce` aggregation operations over a collection.
2424

25+
.. |method| replace:: :method:`~db.collection.mapReduce` helper method
26+
.. include:: /includes/fact-dbcommand-tip
27+
2528
Syntax
2629
------
2730

source/reference/command/reIndex.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Definition
1919

2020
Attempting to run the :dbcommand:`reIndex` command writes a warning
2121
message to the log.
22-
22+
23+
.. |method| replace:: :method:`db.collection.reIndex` helper method
24+
.. include:: /includes/fact-dbcommand-tip
25+
2326
The :dbcommand:`reIndex` command drops all indexes on a
2427
collection and recreates them. This operation may be expensive for
2528
collections that have a large amount of data and/or a large number
@@ -59,7 +62,6 @@ The command takes the following fields:
5962
* - reIndex
6063
- The name of the collection to reindex.
6164

62-
:binary:`~bin.mongosh` provides a wrapper :method:`db.collection.reIndex()`.
6365

6466
Behavior
6567
--------

source/reference/command/renameCollection.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Definition
1919
to :dbcommand:`renameCollection` in the form of a complete
2020
:term:`namespace` (``<database>.<collection>``).
2121

22+
.. |method| replace:: :method:`~db.collection.renameCollection` helper method
23+
.. include:: /includes/fact-dbcommand-tip
24+
2225
Issue the :dbcommand:`renameCollection` command against the
2326
:term:`admin database`.
2427

source/reference/command/update.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ Definition
1717

1818
The :dbcommand:`update` command modifies documents in a collection.
1919
A single :dbcommand:`update` command can contain multiple update
20-
statements. The update methods provided by the MongoDB drivers use
21-
this command internally.
22-
23-
:binary:`~bin.mongosh` provides the following helper methods:
24-
25-
- :method:`db.collection.updateOne()`
26-
- :method:`db.collection.updateMany()`
20+
statements.
21+
22+
.. |method| replace:: :method:`~db.collection.updateOne`,
23+
:method:`~db.collection.updateMany`,
24+
:method:`~db.collection.replaceOne`,
25+
:method:`~db.collection.findOneAndReplace`, and
26+
:method:`~db.collection.findOneAndUpdate`
27+
helper methods
28+
.. include:: /includes/fact-dbcommand-tip
2729

2830
Syntax
2931
------

source/reference/command/validate.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Definition
1818
The :dbcommand:`validate` command checks a collection's data and
1919
indexes for correctness and returns the results.
2020

21+
.. |method| replace:: :method:`~db.collection.validate` helper method
22+
.. include:: /includes/fact-dbcommand-tip
23+
24+
.. versionchanged:: 5.0
25+
2126
Starting in version 5.0, the :dbcommand:`validate` command can also
2227
find inconsistencies in the collection and fix them if possible.
2328

@@ -50,8 +55,6 @@ The command has the following syntax:
5055
}
5156
)
5257

53-
:binary:`~bin.mongosh` also provides a wrapper
54-
:method:`db.collection.validate()`.
5558

5659
Command Fields
5760
--------------

source/reference/method/db.collection.count.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.count(query, options)
1717

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

2221
.. note::
2322

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

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

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

18-
19-
.. include:: /includes/fact-mongosh-shell-method.rst
20-
18+
.. |dbcommand| replace:: :pipeline:`$group` aggregation stage and
19+
the :group:`$sum` expression called by the :dbcommand:`aggregate`
20+
command
21+
.. include:: /includes/fact-mongosh-shell-method-alt
2122

2223
.. versionadded:: 4.0.3
2324

2425
Returns the count of documents that match the query for a collection
25-
or view. The method wraps the :pipeline:`$group` aggregation stage
26-
with a :group:`$sum` expression to perform the count and is
26+
or view. This method is
2727
available for use in :doc:`/core/transactions`.
2828

2929
.. code-block:: javascript

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,18 @@ db.collection.dataSize()
1212

1313
.. method:: db.collection.dataSize()
1414

15-
16-
.. include:: /includes/fact-mongosh-shell-method.rst
17-
15+
.. |dbcommand| replace:: :data:`~collStats.size` field returned by the
16+
:dbcommand:`collStats` command
17+
.. include:: /includes/fact-mongosh-shell-method-alt
1818

1919
:returns: The size in bytes of the collection.
2020

2121
:option:`Data compression <mongod
2222
--wiredTigerCollectionBlockCompressor>` does not affect
2323
this value.
2424

25-
This method provides a wrapper around the :data:`~collStats.size`
26-
output of the :dbcommand:`collStats` (i.e.
27-
:method:`db.collection.stats()`) command.
28-
2925
.. include:: /includes/extracts/4.4-changes-repl-state-restrictions-operation.rst
3026

3127
.. |operations| replace:: :dbcommand:`collStats`
3228

33-
29+

source/reference/method/db.collection.deleteMany.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.deleteMany()
1717

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

2221
Removes all documents that match the ``filter`` from a collection.
2322

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

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

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

18-
19-
.. include:: /includes/fact-mongosh-shell-method.rst
18+
.. |dbcommand| replace:: :dbcommand:`delete` command
19+
.. include:: /includes/fact-mongosh-shell-method-alt
2020

2121

2222
Removes a single document from a collection.

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

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

1818
.. method:: db.collection.drop(<options>)
1919

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

2423
Removes a collection or :doc:`view </core/views>` from the database.
2524
The method also removes any indexes associated with the dropped

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

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

1616
.. method:: db.collection.estimatedDocumentCount(options)
1717

18-
19-
.. include:: /includes/fact-mongosh-shell-method.rst
20-
18+
.. |dbcommand| replace:: :data:`~collStats.count` field returned by the
19+
:dbcommand:`collStats` command
20+
.. include:: /includes/fact-mongosh-shell-method-alt
2121

2222
.. versionadded:: 4.0.3
2323

24-
Returns the count of all documents in a collection or view. The
25-
method wraps the :dbcommand:`count` command.
24+
Returns the count of all documents in a collection or view.
2625

2726
.. code-block:: javascript
2827

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

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

1616
.. method:: db.collection.findOneAndDelete( filter, options )
1717

18-
19-
.. include:: /includes/fact-mongosh-shell-method.rst
18+
.. |dbcommand| replace:: :dbcommand:`delete` command
19+
.. include:: /includes/fact-mongosh-shell-method-alt
2020

2121
Deletes a single document based on the ``filter`` and
2222
``sort`` criteria, returning the deleted document.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Definition
1717

1818
.. method:: db.collection.findOneAndReplace( filter, replacement, options )
1919

20-
21-
.. include:: /includes/fact-mongosh-shell-method.rst
20+
.. |dbcommand| replace:: :dbcommand:`update` command
21+
.. include:: /includes/fact-mongosh-shell-method-alt
2222

2323
Replaces a single document based on the specified :ref:`filter
2424
<findOneAndReplace-filter>`.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Definition
1515

1616
.. method:: db.collection.findOneAndUpdate( filter, update, options )
1717

18-
.. include:: /includes/fact-mongosh-shell-method.rst
18+
.. |dbcommand| replace:: :dbcommand:`update` command
19+
.. include:: /includes/fact-mongosh-shell-method-alt
1920

2021
Updates a single document based on the ``filter`` and
2122
``sort`` criteria.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ Definition
1717

1818
.. versionadded:: 4.4
1919

20-
.. include:: /includes/fact-mongosh-shell-method.rst
20+
.. |dbcommand| replace:: ``index.hidden`` collection option set
21+
using the :dbcommand:`collMod` command
22+
.. include:: /includes/fact-mongosh-shell-method-alt
2123

2224
Hides an existing index from the query planner. An :doc:`index
2325
hidden from the query planner </core/index-hidden>` is not evaluated

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ db.collection.isCapped()
1313
.. method:: db.collection.isCapped()
1414

1515

16-
.. include:: /includes/fact-mongosh-shell-method.rst
17-
16+
.. |dbcommand| replace:: :data:`~collStats.capped` field returned by the
17+
:dbcommand:`collStats` command
18+
.. include:: /includes/fact-mongosh-shell-method-alt
1819

1920
:returns: Returns ``true`` if the collection is a :term:`capped
2021
collection`, otherwise returns ``false``.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ Definition
1616
.. method:: db.collection.latencyStats(options)
1717

1818

19-
.. include:: /includes/fact-mongosh-shell-method.rst
19+
.. |dbcommand| replace:: ``latencyStats`` field returned by the
20+
:dbcommand:`collStats` command
21+
.. include:: /includes/fact-mongosh-shell-method-alt
2022

2123

2224
:method:`db.collection.latencyStats()` returns latency

0 commit comments

Comments
 (0)