From 72d8696a6946083228d8d7ed3ee9caea9bd7f182 Mon Sep 17 00:00:00 2001 From: Kyle Suarez Date: Fri, 8 Jan 2016 14:20:10 -0500 Subject: [PATCH 1/3] DOCS-6942 missing options for db.collection.count The db.collection.count() method actually takes two parameters: an options dictionary, in addition to the query. --- .../apiargs-dbcommand-count-field.yaml | 2 +- ...hod-db.collection.count-options-param.yaml | 60 +++++++++++++++++++ ...args-method-db.collection.count-param.yaml | 10 ++++ source/reference/command/count.txt | 14 +++-- .../reference/method/db.collection.count.txt | 8 ++- 5 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 source/includes/apiargs-method-db.collection.count-options-param.yaml diff --git a/source/includes/apiargs-dbcommand-count-field.yaml b/source/includes/apiargs-dbcommand-count-field.yaml index 3f37b813461..5c4bbe8d1a2 100644 --- a/source/includes/apiargs-dbcommand-count-field.yaml +++ b/source/includes/apiargs-dbcommand-count-field.yaml @@ -50,7 +50,7 @@ operation: count optional: true position: 5 type: -- String +- string - document --- name: readConcern diff --git a/source/includes/apiargs-method-db.collection.count-options-param.yaml b/source/includes/apiargs-method-db.collection.count-options-param.yaml new file mode 100644 index 00000000000..76366d60ace --- /dev/null +++ b/source/includes/apiargs-method-db.collection.count-options-param.yaml @@ -0,0 +1,60 @@ +arg_name: field +description: | + The maximum number of documents to count. +interface: method +name: limit +operation: db.collection.count +optional: true +position: 1 +type: integer +--- +arg_name: field +description: | + The number of documents to skip before counting. +interface: method +name: skip +operation: db.collection.count +optional: true +position: 2 +type: integer +--- +arg_name: field +description: | + An index name hint or specification for the query. + + .. versionadded:: 2.6 +interface: method +name: hint +operation: db.collection.count +optional: true +position: 3 +type: +- string +- document +--- +arg_name: field +description: | + The maximum amount of time to allow the query to run. +interface: method +name: maxTimeMS +operation: db.collection.count +optional: true +position: 4 +type: integer +--- +arg_name: field +description: | + Specifies the :term:`read concern`. + + .. include:: /includes/fact-enable-majority-readConcern.rst + + .. include:: /includes/fact-count-readConcern.rst + + .. versionadded:: 3.2 +interface: method +name: readConcern +operation: db.collection.count +optional: true +position: 4 +type: integer +... diff --git a/source/includes/apiargs-method-db.collection.count-param.yaml b/source/includes/apiargs-method-db.collection.count-param.yaml index 7db095345dc..e57a4e4fa34 100644 --- a/source/includes/apiargs-method-db.collection.count-param.yaml +++ b/source/includes/apiargs-method-db.collection.count-param.yaml @@ -7,4 +7,14 @@ operation: db.collection.count optional: false position: 1 type: document +--- +arg_name: param +description: | + Extra options for modifying the count. +interface: method +name: options +operation: db.collection.count +optional: true +position: 2 +type: document ... diff --git a/source/reference/command/count.txt b/source/reference/command/count.txt index 68d913a445e..becd4e9fb5b 100644 --- a/source/reference/command/count.txt +++ b/source/reference/command/count.txt @@ -17,15 +17,19 @@ Definition Counts the number of documents in a collection. Returns a document that contains this count and as well as the command status. - :dbcommand:`count` has the following form: - .. versionchanged:: 2.6 - :dbcommand:`count` now accepts the ``hint`` option to specify an - index. + :dbcommand:`count` has the following form: .. code-block:: javascript - { count: , query: , limit: , skip: , hint: } + { + count: , + query: , + limit: , + skip: , + hint: , + readConcern: + } :dbcommand:`count` has the following fields: diff --git a/source/reference/method/db.collection.count.txt b/source/reference/method/db.collection.count.txt index 25c8d66f86d..ae2f4e8c02e 100644 --- a/source/reference/method/db.collection.count.txt +++ b/source/reference/method/db.collection.count.txt @@ -13,7 +13,7 @@ db.collection.count() Definition ---------- -.. method:: db.collection.count(query) +.. method:: db.collection.count(query, options) Returns the count of documents that would match a :method:`~db.collection.find()` query. The @@ -21,10 +21,12 @@ Definition :method:`~db.collection.find()` operation but instead counts and returns the number of results that match a query. - The :method:`db.collection.count()` method has the following parameter: - .. include:: /includes/apiargs/method-db.collection.count-param.rst + The ``options`` document contains the following fields: + + .. include:: /includes/apiargs/method-db.collection.count-options-param.rst + The :method:`db.collection.count()` method is equivalent to the ``db.collection.find(query).count()`` construct. From 1732d0908e345915c341f12fef29223d4d19670b Mon Sep 17 00:00:00 2001 From: Kyle Suarez Date: Fri, 8 Jan 2016 13:57:37 -0500 Subject: [PATCH 2/3] DOCS-6874 fix count with read concern The readConcern() shell helper does not work with db.collection.count(), as the latter is not a cursor method. (It returns an integer.) Instead, use the options parameter with db.collection.count() to specify a read concern. You can also chain cursor.count() to a db.collection.find() command with a read concern, like so: db.collection.find().readConcern().count() --- source/includes/ref-toc-method-cursor.yaml | 2 +- source/reference/method/cursor.readConcern.txt | 3 +-- source/reference/method/db.collection.count.txt | 7 ------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/source/includes/ref-toc-method-cursor.yaml b/source/includes/ref-toc-method-cursor.yaml index dcc42fd0e91..9be1c3bddbe 100644 --- a/source/includes/ref-toc-method-cursor.yaml +++ b/source/includes/ref-toc-method-cursor.yaml @@ -68,7 +68,7 @@ description: "Configures the cursor to display results in an easy-to-read format --- name: ":method:`cursor.readConcern()`" file: /reference/method/cursor.readConcern -description: "Specifies a :term:`read concern` for a :method:`find() ` or :method:`count() ` operation." +description: "Specifies a :term:`read concern` for a :method:`find() ` operation." --- name: ":method:`cursor.readPref()`" file: /reference/method/cursor.readPref diff --git a/source/reference/method/cursor.readConcern.txt b/source/reference/method/cursor.readConcern.txt index 2c6deef0d6c..fca7a786bc2 100644 --- a/source/reference/method/cursor.readConcern.txt +++ b/source/reference/method/cursor.readConcern.txt @@ -19,14 +19,13 @@ Definition .. versionadded:: 3.2 Specify a :term:`read concern` for the :method:`db.collection.find()` - or :method:`db.collection.count()` methods. + method. The :method:`~cursor.readConcern()` method has the following form: .. code-block:: javascript db.collection.find().readConcern() - db.collection.count().readConcern() The :method:`~cursor.readConcern()` method has the following parameter: diff --git a/source/reference/method/db.collection.count.txt b/source/reference/method/db.collection.count.txt index ae2f4e8c02e..319d89dbabb 100644 --- a/source/reference/method/db.collection.count.txt +++ b/source/reference/method/db.collection.count.txt @@ -55,13 +55,6 @@ may off by up to 1000 documents as reported by :dbcommand:`collStats`, statistics for the collection, run :dbcommand:`validate` on the collection. -Count with Read Concern -~~~~~~~~~~~~~~~~~~~~~~~ -A :doc:`/reference/readConcern` can be specified with the -:method:`cursor.readConcern()` method. - -.. include:: /includes/fact-count-readConcern.rst - Examples -------- From 26c204c97fdbfecd481cfcec1d5f684c4d2118ca Mon Sep 17 00:00:00 2001 From: Kyle Suarez Date: Mon, 11 Jan 2016 15:00:17 -0500 Subject: [PATCH 3/3] minor: read concern fixes When writing in text, favor "read concern." The camel-cased "readConcern" is acceptable in code or when quoted in backticks as a literal. The read concern and write concern pages now match each other in terms of naming. This commit also has some minor formatting and grammar fixes in various read concern-related pages. --- .../core/sharded-cluster-config-servers.txt | 5 +- .../apiargs-dbcommand-aggregate-field.yaml | 2 +- .../apiargs-dbcommand-count-field.yaml | 14 ++--- .../apiargs-dbcommand-distinct-field.yaml | 2 +- .../apiargs-dbcommand-find-field.yaml | 4 +- .../apiargs-dbcommand-geoNear-field.yaml | 2 +- .../apiargs-dbcommand-geoSearch-field.yaml | 2 +- ...bcommand-parallelCollectionScan-field.yaml | 2 +- ...iargs-method-cursor.readConcern-param.yaml | 4 +- ...hod-db.collection.count-options-param.yaml | 2 +- ...racts-concurrency-consistency-recency.yaml | 2 +- .../includes/fact-aggregate-readConcern.rst | 2 +- source/includes/fact-count-readConcern.rst | 4 +- .../fact-enable-majority-readConcern.rst | 11 ++-- ...t-readConcern-majority-protocolVersion.rst | 5 +- ...t-readConcern-most-recent-data-in-node.rst | 5 +- source/includes/options-conf.yaml | 3 +- source/includes/options-mongod.yaml | 4 +- source/includes/toc-crud-reference.yaml | 2 +- source/reference/command/aggregate.txt | 2 +- source/reference/command/count.txt | 2 +- source/reference/command/distinct.txt | 2 +- source/reference/command/find.txt | 6 +-- source/reference/command/geoNear.txt | 2 +- source/reference/command/geoSearch.txt | 2 +- .../command/parallelCollectionScan.txt | 2 +- source/reference/connection-string.txt | 4 +- source/reference/glossary.txt | 2 +- .../reference/method/cursor.readConcern.txt | 2 +- .../method/db.collection.aggregate.txt | 2 +- .../reference/method/db.collection.count.txt | 2 +- .../{readConcern.txt => read-concern.txt} | 54 +++++++++---------- source/reference/write-concern.txt | 6 +-- source/release-notes/3.2.txt | 2 +- 34 files changed, 82 insertions(+), 87 deletions(-) rename source/reference/{readConcern.txt => read-concern.txt} (51%) diff --git a/source/core/sharded-cluster-config-servers.txt b/source/core/sharded-cluster-config-servers.txt index b0e8a48abd4..21218ece227 100644 --- a/source/core/sharded-cluster-config-servers.txt +++ b/source/core/sharded-cluster-config-servers.txt @@ -83,9 +83,8 @@ MongoDB reads data from the config server in the following cases: - After change in the cluster metadata, such as after a chunk migration. -When reading from the replica set config servers, MongoDB uses -a :doc:`readConcern ` level of -:readconcern:`"majority"`. +When reading from the replica set config servers, MongoDB uses a +:doc:`/reference/read-concern` level of :readconcern:`"majority"`. Config Server Availability -------------------------- diff --git a/source/includes/apiargs-dbcommand-aggregate-field.yaml b/source/includes/apiargs-dbcommand-aggregate-field.yaml index 2db3cee5b6f..7c4dcd7a5f0 100644 --- a/source/includes/apiargs-dbcommand-aggregate-field.yaml +++ b/source/includes/apiargs-dbcommand-aggregate-field.yaml @@ -74,7 +74,7 @@ name: readConcern type: document optional: true description: | - Specifies the :doc:`/reference/readConcern`. + Specifies the :term:`read concern`. .. include:: /includes/fact-enable-majority-readConcern.rst diff --git a/source/includes/apiargs-dbcommand-count-field.yaml b/source/includes/apiargs-dbcommand-count-field.yaml index 5c4bbe8d1a2..ba4c98e0286 100644 --- a/source/includes/apiargs-dbcommand-count-field.yaml +++ b/source/includes/apiargs-dbcommand-count-field.yaml @@ -53,19 +53,19 @@ type: - string - document --- -name: readConcern -position: 6 -type: document +arg_name: field description: | - Specifies the :doc:`/reference/readConcern`. + Specifies the :term:`read concern`. .. include:: /includes/fact-enable-majority-readConcern.rst .. include:: /includes/fact-count-readConcern.rst .. versionadded:: 3.2 -optional: true -operation: count -arg_name: field interface: dbcommand +name: readConcern +operation: count +optional: true +position: 6 +type: document ... diff --git a/source/includes/apiargs-dbcommand-distinct-field.yaml b/source/includes/apiargs-dbcommand-distinct-field.yaml index f7377e49c22..d06617c1d65 100644 --- a/source/includes/apiargs-dbcommand-distinct-field.yaml +++ b/source/includes/apiargs-dbcommand-distinct-field.yaml @@ -33,7 +33,7 @@ name: readConcern position: 4 type: document description: | - Specifies the :doc:`/reference/readConcern`. + Specifies the :term:`read concern`. .. include:: /includes/fact-enable-majority-readConcern.rst diff --git a/source/includes/apiargs-dbcommand-find-field.yaml b/source/includes/apiargs-dbcommand-find-field.yaml index d94ec1cea32..a2769eda45a 100644 --- a/source/includes/apiargs-dbcommand-find-field.yaml +++ b/source/includes/apiargs-dbcommand-find-field.yaml @@ -139,7 +139,7 @@ name: readConcern type: document optional: true description: | - Specifies the :doc:`/reference/readConcern`. + Specifies the :term:`read concern`. .. include:: /includes/fact-enable-majority-readConcern.rst @@ -269,4 +269,4 @@ arg_name: field operation: find interface: command position: 23 -... \ No newline at end of file +... diff --git a/source/includes/apiargs-dbcommand-geoNear-field.yaml b/source/includes/apiargs-dbcommand-geoNear-field.yaml index 76090ff7f2e..8831da175aa 100644 --- a/source/includes/apiargs-dbcommand-geoNear-field.yaml +++ b/source/includes/apiargs-dbcommand-geoNear-field.yaml @@ -164,7 +164,7 @@ name: readConcern position: 12 type: document description: | - Specifies the :doc:`/reference/readConcern`. + Specifies the :term:`read concern`. .. include:: /includes/fact-enable-majority-readConcern.rst diff --git a/source/includes/apiargs-dbcommand-geoSearch-field.yaml b/source/includes/apiargs-dbcommand-geoSearch-field.yaml index c25f0814adc..f6c02a8ef19 100644 --- a/source/includes/apiargs-dbcommand-geoSearch-field.yaml +++ b/source/includes/apiargs-dbcommand-geoSearch-field.yaml @@ -52,7 +52,7 @@ name: readConcern position: 6 type: document description: | - Specifies the :doc:`/reference/readConcern`. + Specifies the :term:`read concern`. .. include:: /includes/fact-enable-majority-readConcern.rst diff --git a/source/includes/apiargs-dbcommand-parallelCollectionScan-field.yaml b/source/includes/apiargs-dbcommand-parallelCollectionScan-field.yaml index 7174002636a..0b8c1942c1d 100644 --- a/source/includes/apiargs-dbcommand-parallelCollectionScan-field.yaml +++ b/source/includes/apiargs-dbcommand-parallelCollectionScan-field.yaml @@ -22,7 +22,7 @@ name: readConcern position: 3 type: document description: | - Specifies the :doc:`/reference/readConcern`. + Specifies the :term:`read concern`. .. include:: /includes/fact-enable-majority-readConcern.rst diff --git a/source/includes/apiargs-method-cursor.readConcern-param.yaml b/source/includes/apiargs-method-cursor.readConcern-param.yaml index de4decd667e..06c858ff2a2 100644 --- a/source/includes/apiargs-method-cursor.readConcern-param.yaml +++ b/source/includes/apiargs-method-cursor.readConcern-param.yaml @@ -1,8 +1,8 @@ name: level arg_name: param description: | - One of the following :term:`read concern` modes: :readconcern:`"local"` or - :readconcern:`"majority"` + One of the following :term:`read concern` modes: + :readconcern:`"local"` or :readconcern:`"majority"` interface: method operation: cursor.readConcern optional: true diff --git a/source/includes/apiargs-method-db.collection.count-options-param.yaml b/source/includes/apiargs-method-db.collection.count-options-param.yaml index 76366d60ace..37093ffee70 100644 --- a/source/includes/apiargs-method-db.collection.count-options-param.yaml +++ b/source/includes/apiargs-method-db.collection.count-options-param.yaml @@ -56,5 +56,5 @@ name: readConcern operation: db.collection.count optional: true position: 4 -type: integer +type: string ... diff --git a/source/includes/extracts-concurrency-consistency-recency.yaml b/source/includes/extracts-concurrency-consistency-recency.yaml index 6dd70716044..727b2c7efde 100644 --- a/source/includes/extracts-concurrency-consistency-recency.yaml +++ b/source/includes/extracts-concurrency-consistency-recency.yaml @@ -100,7 +100,7 @@ content: | .. versionchanged:: 3.2 For replica sets and sharded clusters, MongoDB provides monotonic - reads if read operations specify :doc:`/reference/readConcern` + reads if read operations specify :doc:`/reference/read-concern` ``"majority"`` and read preference :readmode:`primary`. In previous versions, MongoDB cannot make monotonic read diff --git a/source/includes/fact-aggregate-readConcern.rst b/source/includes/fact-aggregate-readConcern.rst index 14547688ee9..54c566846ee 100644 --- a/source/includes/fact-aggregate-readConcern.rst +++ b/source/includes/fact-aggregate-readConcern.rst @@ -1,2 +1,2 @@ -To use a :doc:`/reference/readConcern` level of :readconcern:`"majority"`, you +To use a :doc:`/reference/read-concern` level of :readconcern:`"majority"`, you cannot include the :pipeline:`$out` stage. diff --git a/source/includes/fact-count-readConcern.rst b/source/includes/fact-count-readConcern.rst index 6ecd03104a3..c178373ee26 100644 --- a/source/includes/fact-count-readConcern.rst +++ b/source/includes/fact-count-readConcern.rst @@ -1,2 +1,2 @@ -To use a :doc:`/reference/readConcern` level of :readconcern:`"majority"`, you -must specify a nonempty ``query`` condition. +To use a :term:`read concern` level of :readconcern:`"majority"`, you must +specify a nonempty ``query`` condition. diff --git a/source/includes/fact-enable-majority-readConcern.rst b/source/includes/fact-enable-majority-readConcern.rst index 85e800c6184..16dccaa08c8 100644 --- a/source/includes/fact-enable-majority-readConcern.rst +++ b/source/includes/fact-enable-majority-readConcern.rst @@ -1,8 +1,7 @@ -To use a :doc:`/reference/readConcern` level of -:readconcern:`"majority"`, you must use the WiredTiger storage engine -and start the :program:`mongod` instances with the -:option:`--enableMajorityReadConcern` command line option (or the -:setting:`replication.enableMajorityReadConcern` setting if using a -configuration file). +To use a :term:`read concern` level of :readconcern:`"majority"`, you +must use the WiredTiger storage engine and start the :program:`mongod` +instances with the :option:`--enableMajorityReadConcern` command line +option (or the :setting:`replication.enableMajorityReadConcern` setting +if using a configuration file). .. include:: /includes/fact-readConcern-majority-protocolVersion.rst diff --git a/source/includes/fact-readConcern-majority-protocolVersion.rst b/source/includes/fact-readConcern-majority-protocolVersion.rst index 8cf53d2dc3e..ce17ab80115 100644 --- a/source/includes/fact-readConcern-majority-protocolVersion.rst +++ b/source/includes/fact-readConcern-majority-protocolVersion.rst @@ -1,3 +1,4 @@ Only replica sets using :rsconf:`protocol version 1 ` -support :readconcern:`"majority"` readConcern. Replica sets running protocol -version 0 do not support :readconcern:`"majority"` readConcern. +support :readconcern:`"majority"` read concern. Replica sets running +protocol version 0 do not support :readconcern:`"majority"` read +concern. diff --git a/source/includes/fact-readConcern-most-recent-data-in-node.rst b/source/includes/fact-readConcern-most-recent-data-in-node.rst index 4b544513d7f..ff111a0ea26 100644 --- a/source/includes/fact-readConcern-most-recent-data-in-node.rst +++ b/source/includes/fact-readConcern-most-recent-data-in-node.rst @@ -1,3 +1,2 @@ -Regardless of the :doc:`/reference/readConcern` level, the most recent -data on a node may not reflect the most recent version of the data in the -system. +Regardless of the :term:`read concern` level, the most recent data on a +node may not reflect the most recent version of the data in the system. diff --git a/source/includes/options-conf.yaml b/source/includes/options-conf.yaml index c652db3ad43..564e337bcae 100644 --- a/source/includes/options-conf.yaml +++ b/source/includes/options-conf.yaml @@ -1724,8 +1724,7 @@ description: | .. versionadded:: 3.2 - Enables :doc:`readConcern ` level of - ``"majority"``. + Enables :term:`read concern` level of ``"majority"``. --- program: conf name: sharding.configsvrMode diff --git a/source/includes/options-mongod.yaml b/source/includes/options-mongod.yaml index 233eaada7c3..e29c211e2e0 100644 --- a/source/includes/options-mongod.yaml +++ b/source/includes/options-mongod.yaml @@ -2020,8 +2020,8 @@ description: | .. versionadded:: 3.2 - Enables :doc:`readConcern ` level of - ``"majority"``. By default, ``"majority"`` level is not enabled. + Enables :term:`read concern` level of ``"majority"``. By default, + ``"majority"`` level is not enabled. --- program: mongod name: configsvrMode diff --git a/source/includes/toc-crud-reference.yaml b/source/includes/toc-crud-reference.yaml index 0c1c8f0a866..df4f7b37b9b 100644 --- a/source/includes/toc-crud-reference.yaml +++ b/source/includes/toc-crud-reference.yaml @@ -2,7 +2,7 @@ file: /reference/write-concern description: | Description of the write operation acknowledgements returned by MongoDB. --- -file: /reference/readConcern +file: /reference/read-concern description: | Description of the ``readConcern`` option. --- diff --git a/source/reference/command/aggregate.txt b/source/reference/command/aggregate.txt index 4d20a876e54..1f7ea18a44d 100644 --- a/source/reference/command/aggregate.txt +++ b/source/reference/command/aggregate.txt @@ -207,7 +207,7 @@ Override Default ``readConcern`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following operation on a replica set specifies a -:doc:`/reference/readConcern` of :readconcern:`"majority"` to read the +:doc:`/reference/read-concern` of :readconcern:`"majority"` to read the most recent copy of the data confirmed as having been written to a majority of the nodes. diff --git a/source/reference/command/count.txt b/source/reference/command/count.txt index becd4e9fb5b..17c77caab36 100644 --- a/source/reference/command/count.txt +++ b/source/reference/command/count.txt @@ -147,7 +147,7 @@ Override Default ``readConcern`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following operation on a replica set specifies a -:doc:`/reference/readConcern` of :readconcern:`"majority"` to read the +:doc:`/reference/read-concern` of :readconcern:`"majority"` to read the most recent copy of the data confirmed as having been written to a majority of the nodes. diff --git a/source/reference/command/distinct.txt b/source/reference/command/distinct.txt index ffe5124870b..601c6a8fc24 100644 --- a/source/reference/command/distinct.txt +++ b/source/reference/command/distinct.txt @@ -163,7 +163,7 @@ Override Default ``readConcern`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following operation on a replica set specifies a -:doc:`/reference/readConcern` of :readconcern:`"majority"` to read the +:doc:`/reference/read-concern` of :readconcern:`"majority"` to read the most recent copy of the data confirmed as having been written to a majority of the nodes. diff --git a/source/reference/command/find.txt b/source/reference/command/find.txt index c790106bbb9..c9dd96f52d5 100644 --- a/source/reference/command/find.txt +++ b/source/reference/command/find.txt @@ -84,9 +84,9 @@ field and limits the result set to 5 documents. Override Default ``readConcern`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The following operation on a replica set specifies a :doc:`/reference/readConcern` -of :readconcern:`"majority"` to read the most recent copy of the data -confirmed as having been written to a majority of the nodes. +The following operation on a replica set specifies a :term:`read +concern` of :readconcern:`"majority"` to read the most recent copy of +the data confirmed as having been written to a majority of the nodes. .. note:: diff --git a/source/reference/command/geoNear.txt b/source/reference/command/geoNear.txt index 18d7d72cb8c..d96afc2fdd7 100644 --- a/source/reference/command/geoNear.txt +++ b/source/reference/command/geoNear.txt @@ -227,7 +227,7 @@ Override Default ``readConcern`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following operation on a replica set specifies a -:doc:`/reference/readConcern` of :readconcern:`"majority"` to read the +:doc:`/reference/read-concern` of :readconcern:`"majority"` to read the most recent copy of the data confirmed as having been written to a majority of the nodes. diff --git a/source/reference/command/geoSearch.txt b/source/reference/command/geoSearch.txt index 738dda20661..bae2ebcc89a 100644 --- a/source/reference/command/geoSearch.txt +++ b/source/reference/command/geoSearch.txt @@ -55,7 +55,7 @@ Override Default ``readConcern`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following operation on a replica set specifies a -:doc:`/reference/readConcern` of :readconcern:`"majority"` to read the +:doc:`/reference/read-concern` of :readconcern:`"majority"` to read the most recent copy of the data confirmed as having been written to a majority of the nodes. diff --git a/source/reference/command/parallelCollectionScan.txt b/source/reference/command/parallelCollectionScan.txt index 31c2838389d..67aefc73a44 100644 --- a/source/reference/command/parallelCollectionScan.txt +++ b/source/reference/command/parallelCollectionScan.txt @@ -48,7 +48,7 @@ Example ------- The following operation on a replica set specifies a -:doc:`/reference/readConcern` of :readconcern:`"majority"` to read the +:doc:`/reference/read-concern` of :readconcern:`"majority"` to read the most recent copy of the data confirmed as having been written to a majority of the nodes. diff --git a/source/reference/connection-string.txt b/source/reference/connection-string.txt index 9437826afdd..eb2d83e113f 100644 --- a/source/reference/connection-string.txt +++ b/source/reference/connection-string.txt @@ -281,7 +281,7 @@ full explanation of write concern and write operations in general, see For the WiredTiger storage engine, MongoDB 3.2 introduces the readConcern option for replica sets and replica set shards. -:doc:`/reference/readConcern` allows clients to choose a level of +:doc:`/reference/read-concern` allows clients to choose a level of isolation for their reads from replica sets. .. data:: uri.readConcernLevel @@ -289,7 +289,7 @@ isolation for their reads from replica sets. The level of isolation. Accepts either :readconcern:`"local"` or :readconcern:`"majority"`. - For details, see :doc:`/reference/readConcern`. + For details, see :doc:`/reference/read-concern`. Read Preference Options ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/reference/glossary.txt b/source/reference/glossary.txt index 4e08f824fe2..dec7ac348d4 100644 --- a/source/reference/glossary.txt +++ b/source/reference/glossary.txt @@ -746,7 +746,7 @@ Glossary Specifies a level of isolation for read operations. For example, you can use read concern to only read data that has propagated to a majority of nodes in a :term:`replica set`. See - :doc:`Read Concern `. + :doc:`/reference/read-concern`. read preference A setting that determines how clients direct read operations. diff --git a/source/reference/method/cursor.readConcern.txt b/source/reference/method/cursor.readConcern.txt index fca7a786bc2..bc8ff918f17 100644 --- a/source/reference/method/cursor.readConcern.txt +++ b/source/reference/method/cursor.readConcern.txt @@ -34,4 +34,4 @@ Definition .. include:: /includes/fact-enable-majority-readConcern.rst -.. seealso:: :doc:`/reference/readConcern` +.. seealso:: :doc:`/reference/read-concern` diff --git a/source/reference/method/db.collection.aggregate.txt b/source/reference/method/db.collection.aggregate.txt index c3ad7d33e53..d7c4b544373 100644 --- a/source/reference/method/db.collection.aggregate.txt +++ b/source/reference/method/db.collection.aggregate.txt @@ -212,7 +212,7 @@ Override ``readConcern`` ~~~~~~~~~~~~~~~~~~~~~~~~ The following operation on a replica set specifies a -:doc:`/reference/readConcern` of :readconcern:`"majority"` to read the +:doc:`/reference/read-concern` of :readconcern:`"majority"` to read the most recent copy of the data confirmed as having been written to a majority of the nodes. diff --git a/source/reference/method/db.collection.count.txt b/source/reference/method/db.collection.count.txt index 319d89dbabb..8ce5afc5032 100644 --- a/source/reference/method/db.collection.count.txt +++ b/source/reference/method/db.collection.count.txt @@ -27,7 +27,7 @@ Definition .. include:: /includes/apiargs/method-db.collection.count-options-param.rst - The :method:`db.collection.count()` method is equivalent to the + :method:`~db.collection.count()` is equivalent to the ``db.collection.find(query).count()`` construct. .. seealso:: :method:`cursor.count()` diff --git a/source/reference/readConcern.txt b/source/reference/read-concern.txt similarity index 51% rename from source/reference/readConcern.txt rename to source/reference/read-concern.txt index 2823471d8a8..bbb0793e57c 100644 --- a/source/reference/readConcern.txt +++ b/source/reference/read-concern.txt @@ -1,6 +1,6 @@ -=========== -readConcern -=========== +============ +Read Concern +============ .. default-domain:: mongodb @@ -12,31 +12,31 @@ readConcern .. versionadded:: 3.2 -MongoDB 3.2 introduces the ``readConcern`` query option for replica -sets and replica set shards. For the :doc:`WiredTiger storage engine -`, the ``readConcern`` option allows clients to -choose a level of isolation for their reads. You can specify a -``readConcern`` of ``"majority"`` to read data that has been written to -a majority of nodes and thus cannot be rolled back. By default, MongoDB -uses a ``readConcern`` of ``"local"`` to return the most recent data -available to the node at the time of the query, even if the data has -not been persisted to a majority of nodes and may be rolled back. With -the :doc:`MMAPv1 storage engine `, you can only specify a -``readConcern`` of ``"local"``. +MongoDB 3.2 introduces the ``readConcern`` query option for replica sets +and replica set shards. For the :doc:`WiredTiger storage engine +`, the ``readConcern`` option allows clients to choose +a level of isolation for their reads. You can specify a read concern of +``"majority"`` to read data that has been written to a majority of +replica set members and thus cannot be rolled back. By default, MongoDB +uses a read concern of ``"local"`` to return the most recent data +available to the MongoDB instance at the time of the query, even if the +data has not been persisted to a majority of replica set members and may +be rolled back. With the :doc:`MMAPv1 storage engine `, +you can only specify a ``readConcern`` of ``"local"``. ``readConcern`` requires MongoDB drivers updated for 3.2. -``readConcern`` Levels ----------------------- +Read Concern Levels +------------------- By default, MongoDB uses a ``readConcern`` of ``"local"`` which does not guarantee that the read data would not be rolled back. -You can specify a ``readConcern`` of ``"majority"`` to -read data that has been written to a majority of nodes and thus cannot -be rolled back. +You can specify a ``readConcern`` of ``"majority"`` to read data that +has been written to a majority of replica set members and thus cannot be +rolled back. -.. list-table:: +.. list-table:: :header-rows: 1 :widths: 10 90 @@ -45,25 +45,23 @@ be rolled back. * - .. readconcern:: "local" - - Default. The query will return the node's most recent copy of + - Default. The query returns the instance's most recent copy of data. Provides no guarantee that the data has been written to a - majority of the nodes. + majority of the replica set members. * - .. readconcern:: "majority" - - The query will return the node's most recent copy of the data - confirmed as having been written to a majority of the nodes. + - The query returns the instance's most recent copy of data + confirmed as written to a majority of members in the replica set. .. include:: /includes/fact-enable-majority-readConcern.rst -.. note:: - The most recent data on a node, regardless of the level, may not - reflect the most recent version of the data in the system. +.. include:: /includes/fact-readConcern-most-recent-data-in-node.rst ``readConcern`` Option ---------------------- -Use the ``readConcern`` option to specify the readConcern level. +Use the ``readConcern`` option to specify the read concern level. .. code-block:: javascript diff --git a/source/reference/write-concern.txt b/source/reference/write-concern.txt index 84a7712b363..aff8bda6f62 100644 --- a/source/reference/write-concern.txt +++ b/source/reference/write-concern.txt @@ -3,9 +3,9 @@ .. _write-concern-internals: .. _write-concern: -======================= -Write Concern Reference -======================= +============= +Write Concern +============= .. default-domain:: mongodb diff --git a/source/release-notes/3.2.txt b/source/release-notes/3.2.txt index 3900e23b5cf..c46462c9f67 100644 --- a/source/release-notes/3.2.txt +++ b/source/release-notes/3.2.txt @@ -155,7 +155,7 @@ the :doc:`MMAPv1 storage engine `, you can only specify a .. include:: /includes/fact-readConcern-majority-protocolVersion.rst For details on ``readConcern``, including operations that support the -option, see :doc:`/reference/readConcern`. +option, see :doc:`/reference/read-concern`. Partial Indexes ---------------