File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ Schema Validation
17
17
MongoDB provides the capability to perform schema validation during
18
18
updates and insertions.
19
19
20
+ .. _schema-validation-document:
21
+
20
22
Specify Validation Rules
21
23
------------------------
22
24
Original file line number Diff line number Diff line change @@ -10,4 +10,8 @@ Index inconsistencies include:
10
10
11
11
If any inconsistencies are detected by the
12
12
:method: `db.collection.validate() ` command, a warning is returned
13
- and the repair flag on the index is set to ``true ``.
13
+ and the repair flag on the index is set to ``true ``.
14
+
15
+ :method: `db.collection.validate() ` also validates any documents that
16
+ violate the collection's
17
+ :ref: `schema validation rules <schema-validation-document >`.
Original file line number Diff line number Diff line change @@ -761,6 +761,15 @@ The :dbcommand:`validate` command and :method:`db.collection.validate()`
761
761
helper method also return a new :data:`~validate.repaired` boolean value
762
762
that is ``true`` if the collection was repaired.
763
763
764
+ ``validate`` Command Reports Document Schema Violations
765
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
766
+
767
+ Starting in MongoDB 5.0, :dbcommand:`validate` and
768
+ :method:`db.collection.validate()` validates documents
769
+ in a collection. The commands report if any
770
+ :ref:`schema validation rules <schema-validation-document>` are
771
+ violated.
772
+
764
773
Repair Option in ``mongod``
765
774
~~~~~~~~~~~~~~~~~~~~~~~~~~~
766
775
You can’t perform that action at this time.
0 commit comments