@@ -55,26 +55,20 @@ validation in the following scenarios:
55
55
from accidentally misspelling an item name when entering sales data.
56
56
57
57
- For a students collection, ensure that the ``gpa`` field is always a
58
- positive number. This validation catches typos during data entry.
58
+ positive number. This validation prevents errors during data entry.
59
59
60
60
When MongoDB Checks Validation
61
61
------------------------------
62
62
63
- When you create a new collection with schema validation, MongoDB checks
64
- validation during updates and inserts in that collection.
63
+ After you add schema validation rules to a collection:
65
64
66
- When you add validation to an existing, non-empty collection:
67
-
68
- - Newly inserted documents are checked for validation.
69
-
70
- - Documents already existing in your collection are not checked for
71
- validation until they are modified. Specific behavior for existing
72
- documents depends on your chosen validation level. To learn more, see
65
+ - All document inserts must match the rules.
66
+ - The schema validation level defines how the rules are applied to
67
+ existing documents and document updates. To learn more, see
73
68
:ref:`schema-specify-validation-level`.
74
69
75
- Adding validation to an existing collection does not enforce validation
76
- on existing documents. To check a collection for invalid documents, use
77
- the :dbcommand:`validate` command.
70
+ To find documents in a collection that don't match the schema validation
71
+ rules, see :ref:`use-json-schema-query-conditions-find-documents`.
78
72
79
73
What Happens When a Document Fails Validation
80
74
---------------------------------------------
0 commit comments