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 @@ -776,6 +776,15 @@ The :dbcommand:`validate` command and :method:`db.collection.validate()`
776776helper method also return a new :data:`~validate.repaired` boolean value
777777that is ``true`` if the collection was repaired.
778778
779+ ``validate`` Command Reports Document Schema Violations
780+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
781+
782+ Starting in MongoDB 5.0, :dbcommand:`validate` and
783+ :method:`db.collection.validate()` validates documents
784+ in a collection. The commands report if any
785+ :ref:`schema validation rules <schema-validation-document>` are
786+ violated.
787+
779788Repair Option in ``mongod``
780789~~~~~~~~~~~~~~~~~~~~~~~~~~~
781790
You can’t perform that action at this time.
0 commit comments