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
1717MongoDB provides the capability to perform schema validation during
1818updates and insertions.
1919
20+ .. _schema-validation-document:
21+
2022Specify Validation Rules
2123------------------------
2224
Original file line number Diff line number Diff line change @@ -10,4 +10,8 @@ Index inconsistencies include:
1010
1111If any inconsistencies are detected by the
1212: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()`
761761helper method also return a new :data:`~validate.repaired` boolean value
762762that is ``true`` if the collection was repaired.
763763
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+
764773Repair Option in ``mongod``
765774~~~~~~~~~~~~~~~~~~~~~~~~~~~
766775
You can’t perform that action at this time.
0 commit comments