forked from mongodb/docs-compass
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsteps-create-validation-rule-via-json.yaml
More file actions
55 lines (46 loc) · 1.45 KB
/
Copy pathsteps-create-validation-rule-via-json.yaml
File metadata and controls
55 lines (46 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
title: Update :guilabel:`Validation Action` and :guilabel:`Validation Level`.
level: 4
ref: validation-action-level
content: |
Select the appropriate :guilabel:`Validation Action` and
:guilabel:`Validation Level`.
For more information on validation actions and levels, see
:ref:`this section <validation-actions-levels>`. Additional
information is available in the :manual:`MongoDB Manual
</core/document-validation>`.
---
title: Specify the validation rules.
level: 4
ref: add-rule
content: |
In the editor, enter the validation rules in strict JSON format.
.. example::
The following rule only allows documents where *either* the
``BeginDate`` field is greater than ``1950`` *or* the
``EndDate`` field is ``null``.
.. code-block:: json
{
"$or": [
{ "BeginDate": { "$gt": 1950 } },
{ "EndDate": null }
]
}
.. note::
If you specify a rule in the JSON editor which cannot be
displayed in the :guilabel:`Rule Builder`, you will not
be able to access the :guilabel:`Rule Builder`.
---
title: Verify JSON.
level: 4
ref: verify-rule
content: |
When finished editing, hit the :guilabel:`Tab` key or click outside
the editor box.
If the JSON document is invalid, an error message displays. Fix any
errors.
---
title: Click :guilabel:`Update` to create/update validation rules.
level: 4
ref: update-rule-button
content: ""
...