Skip to content

Commit ceed21f

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-22283 validate extensions (#1910)
* DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions * DOCSP-22283-validate-extensions Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 0eebaed commit ceed21f

File tree

5 files changed

+95
-13
lines changed

5 files changed

+95
-13
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*Optional*. If ``true``, the collection is checked to ensure the
2+
:ref:`BSON documents <bson-document-format>` conform to the BSON
3+
specifications. The checks increase the time to complete the validation
4+
operation. Any issues are returned as a warning.
5+
6+
``checkBSONConformance``:
7+
8+
- Default is ``false``.
9+
- Is enabled when ``full`` is set to ``true``.
10+
- Cannot be used with:
11+
12+
- ``repair`` set to ``true``.
13+
- ``metadata`` set to ``true``.
14+
15+
.. versionadded:: 6.2
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Starting in MongoDB 6.2, the :dbcommand:`validate` command and
2+
:method:`db.collection.validate()` method:
3+
4+
- Check collections to ensure the
5+
:ref:`BSON documents <bson-document-format>` conform to the BSON
6+
specifications.
7+
- Check :ref:`time series collections <manual-timeseries-collection>`
8+
for internal data inconsistencies.
9+
- Have a new option ``checkBSONConformance`` that enables comprehensive
10+
BSON checks.

source/reference/command/validate.txt

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ validate
1313
Definition
1414
----------
1515

16+
.. versionchanged:: 6.2
17+
1618
.. dbcommand:: validate
1719

1820
The :dbcommand:`validate` command checks a collection's data and
1921
indexes for correctness and returns the results.
2022

21-
Starting in version 5.0, the :dbcommand:`validate` command can also
23+
Starting in MongoDB 5.0, the :dbcommand:`validate` command can also
2224
find inconsistencies in the collection and fix them if possible.
2325

2426
.. include:: /includes/fact-validate-standalone-inconsistencies.rst
@@ -35,18 +37,17 @@ Definition
3537
Syntax
3638
------
3739

38-
.. versionchanged:: 5.0
39-
4040
The command has the following syntax:
4141

4242
.. code-block:: javascript
4343

4444
db.runCommand(
4545
{
46-
validate: <string>, // Collection name
47-
full: <boolean>, // Optional
48-
repair: <boolean>, // Optional, added in MongoDB 5.0
49-
metadata: <boolean> // Optional, added in MongoDB 5.0.4
46+
validate: <string>, // Collection name
47+
full: <boolean>, // Optional
48+
repair: <boolean>, // Optional, added in MongoDB 5.0
49+
metadata: <boolean>, // Optional, added in MongoDB 5.0.4
50+
checkBSONConformance: <boolean> // Optional, added in MongoDB 6.2
5051
}
5152
)
5253

@@ -60,7 +61,7 @@ The command takes the following fields:
6061

6162
.. list-table::
6263
:header-rows: 1
63-
:widths: 10 10 50
64+
:widths: 15 15 70
6465

6566
* - Field
6667
- Type
@@ -103,6 +104,12 @@ The command takes the following fields:
103104

104105
.. include:: /includes/fact-validate-metadata.rst
105106

107+
* - :ref:`checkBSONConformance <cmd-validate-checkBSONConformance>`
108+
- boolean
109+
- .. _cmd-validate-checkBSONConformance:
110+
111+
.. include:: /includes/fact-validate-conformance.rst
112+
106113
Behavior
107114
--------
108115

@@ -131,6 +138,11 @@ Data Throughput Metrics
131138

132139
.. include:: /includes/extracts/4.4-validate-data-throughput.rst
133140

141+
Collection Validation Improvements
142+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143+
144+
.. include:: /includes/validate-improvements-introduction.rst
145+
134146
Restrictions
135147
~~~~~~~~~~~~~
136148

@@ -173,6 +185,14 @@ Examples
173185

174186
db.runCommand( { validate: "myCollection", metadata: true } )
175187

188+
- To perform additional BSON conformance checks in ``myCollection``,
189+
specify :ref:`checkBSONConformance: true
190+
<cmd-validate-checkBSONConformance>`:
191+
192+
.. code-block:: javascript
193+
194+
db.runCommand( { validate: "myCollection", checkBSONConformance: true } )
195+
176196
.. _validate-output:
177197

178198
Validate Output
@@ -182,6 +202,12 @@ Validate Output
182202

183203
Specify :ref:`full: true <cmd-validate-full>` for more detailed output.
184204

205+
.. data:: validate.uuid
206+
207+
The universally unique identifier (UUID) for the collection.
208+
209+
.. versionadded:: 6.2
210+
185211
.. data:: validate.nInvalidDocuments
186212

187213
The number of invalid documents in the collection. Invalid documents
@@ -194,6 +220,11 @@ Specify :ref:`full: true <cmd-validate-full>` for more detailed output.
194220
Non-compliant documents are not counted as invalid in
195221
:data:`~validate.nInvalidDocuments`.
196222

223+
Starting in MongoDB 6.2, ``nNonCompliantDocuments`` also includes the
224+
number of documents that do not conform to the :term:`BSON`
225+
or :ref:`time series collection <manual-timeseries-collection>`
226+
requirements.
227+
197228
.. data:: validate.nrecords
198229

199230
The number of :term:`documents <document>` in the collection.

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ db.collection.validate()
1515
Description
1616
-----------
1717

18+
.. versionchanged:: 6.2
19+
1820
.. method:: db.collection.validate(<documents>)
1921

2022
.. include:: /includes/fact-mongosh-shell-method.rst
@@ -39,15 +41,14 @@ Syntax
3941
:method:`db.collection.validate()` no longer accepts just a boolean
4042
parameter. See :ref:`4.4-validate-method-signature`.
4143

42-
.. versionchanged:: 5.0
43-
4444
The :method:`db.collection.validate()` method has the following syntax:
4545

4646
.. code-block:: javascript
4747

4848
db.collection.validate( {
49-
full: <boolean>, // Optional
50-
repair: <boolean> // Optional, added in MongoDB 5.0
49+
full: <boolean>, // Optional
50+
repair: <boolean>, // Optional, added in MongoDB 5.0
51+
checkBSONConformance: <boolean> // Optional, added in MongoDB 6.2
5152
} )
5253

5354
Parameters
@@ -58,7 +59,7 @@ following optional document parameter with the fields:
5859

5960
.. list-table::
6061
:header-rows: 1
61-
:widths: 10 10 50
62+
:widths: 15 15 70
6263

6364
* - Field
6465
- Type
@@ -93,6 +94,13 @@ following optional document parameter with the fields:
9394

9495
.. include:: /includes/fact-validate-repair-option.rst
9596

97+
* - :ref:`checkBSONConformance
98+
<method-validate-checkBSONConformance>`
99+
- boolean
100+
- .. _method-validate-checkBSONConformance:
101+
102+
.. include:: /includes/fact-validate-conformance.rst
103+
96104
Behavior
97105
--------
98106

@@ -142,6 +150,11 @@ Data Throughput Metrics
142150

143151
.. include:: /includes/extracts/4.4-validate-data-throughput.rst
144152

153+
Collection Validation Improvements
154+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
155+
156+
.. include:: /includes/validate-improvements-introduction.rst
157+
145158
Examples
146159
--------
147160

@@ -170,4 +183,12 @@ Examples
170183

171184
db.myCollection.validate( { repair: true } )
172185

186+
- To perform additional BSON conformance checks in ``myCollection``,
187+
specify :ref:`checkBSONConformance: true
188+
<method-validate-checkBSONConformance>`:
189+
190+
.. code-block:: javascript
191+
192+
db.myCollection.validate( { checkBSONConformance: true } )
193+
173194
For details of the output, see :ref:`validate-output`.

source/release-notes/6.2.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ these output changes:
6363
range.
6464
Total number of connection requests for all time ranges.
6565

66+
Collection Validation Improvements
67+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68+
69+
.. include:: /includes/validate-improvements-introduction.rst
70+
6671
Server Parameters
6772
-----------------
6873

0 commit comments

Comments
 (0)