Skip to content

Commit 9b1907e

Browse files
committed
DOCSP-41059-validation-update
1 parent acf8e07 commit 9b1907e

File tree

1 file changed

+37
-24
lines changed

1 file changed

+37
-24
lines changed

source/validation.txt

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,44 +79,57 @@ Consider the following example validation:
7979
.. code-block:: json
8080

8181
{
82-
$jsonSchema: {
83-
bsonType: "object",
84-
required: [ "address", "borough", "address.coord", "address.coord0", "address.coord.1", "name"],
85-
properties: {
86-
address: {
87-
bsonType: "object",
88-
description: "must be an object"
89-
},
90-
address.coord.0: {
91-
minimum: -180,
92-
maximum: 180,
93-
exclusiveMaximum: false,
94-
description: "must be an number in [ -180, 180 ]"
82+
"$jsonSchema": {
83+
"bsonType": "object",
84+
"required": [ "address", "borough", "name" ],
85+
"properties": {
86+
"address": {
87+
"bsonType": "object",
88+
"properties": {
89+
"coord": {
90+
"bsonType": "array",
91+
"items": [
92+
{
93+
"bsonType": "double",
94+
"minimum": -180,
95+
"maximum": 180,
96+
"exclusiveMaximum": false,
97+
"description": "must be a number in [ -180, 180 ]"
98+
},
99+
{
100+
"bsonType": "double",
101+
"minimum": -90,
102+
"maximum": 90,
103+
"exclusiveMaximum": false,
104+
"description": "must be a number in [ -90, 90 ]"
105+
}
106+
]
107+
}
108+
},
109+
"description": "must be an object"
95110
},
96-
address.coord.1: {
97-
minimum: -90,
98-
maximum: 90,
99-
exclusiveMaximum: false,
100-
description: "must be an number in [ -90, 90 ]"
101-
},
102-
borough: {
103-
bsonType: [ "string" ],
104-
enum: [ "Manhattan", "Brooklyn", "Queens", "Bronx", "Staten Island" ]
105-
description: "must be one of the enum strings"
111+
"borough": {
112+
"bsonType": "string",
113+
"enum": [ "Manhattan", "Brooklyn", "Queens", "Bronx", "Staten Island" ],
114+
"description": "must be one of the enum strings"
106115
}
107116
}
108117
}
109118
}
110119

120+
111121
This validation specifies:
112122

113123
- The list of
114124
:manual:`required </reference/operator/query/jsonSchema/#available-keywords>`
115125
fields.
116126

127+
- The :manual:`bsonType </reference/operator/query/jsonSchema/#available-keywords>` for
128+
all required fields.
129+
117130
- The :manual:`minimum </reference/operator/query/jsonSchema/#available-keywords>`
118131
and :manual:`maximum </reference/operator/query/jsonSchema/#available-keywords>`
119-
values for the ``address.coord.0`` and ``address.coord.1`` fields.
132+
values in the ``address.coord`` array.
120133

121134
- The acceptable values for the ``borough`` field, using
122135
:manual:`enum </reference/operator/query/jsonSchema/#available-keywords>`.

0 commit comments

Comments
 (0)