Skip to content

Commit d4c08f9

Browse files
committed
DOCSP-41059-validation-update
1 parent 9f8b9df commit d4c08f9

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

source/validation.txt

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ To specify JSON Schema validation, use the
5151
:manual:`$jsonSchema </reference/operator/query/jsonSchema>`
5252
operator.
5353

54-
.. code-block:: json
54+
.. code-block:: javascript
5555

5656
{
5757
$jsonSchema: {
@@ -76,42 +76,42 @@ example:
7676

7777
Consider the following example validation:
7878

79-
.. code-block:: json
79+
.. code-block:: javascript
8080

8181
{
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": [
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: [
9292
{
93-
"bsonType": "double",
94-
"minimum": -180,
95-
"maximum": 180,
96-
"exclusiveMaximum": false,
97-
"description": "must be a number in [ -180, 180 ]"
93+
bsonType: "double",
94+
minimum: -180,
95+
maximum: 180,
96+
exclusiveMaximum: false,
97+
description: "must be a number in [ -180, 180 ]"
9898
},
9999
{
100-
"bsonType": "double",
101-
"minimum": -90,
102-
"maximum": 90,
103-
"exclusiveMaximum": false,
104-
"description": "must be a number in [ -90, 90 ]"
100+
bsonType: "double",
101+
minimum: -90,
102+
maximum: 90,
103+
exclusiveMaximum: false,
104+
description: "must be a number in [ -90, 90 ]"
105105
}
106106
]
107107
}
108108
},
109-
"description": "must be an object"
109+
description: "must be an object"
110110
},
111-
"borough": {
112-
"bsonType": "string",
113-
"enum": [ "Manhattan", "Brooklyn", "Queens", "Bronx", "Staten Island" ],
114-
"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"
115115
}
116116
}
117117
}
@@ -146,15 +146,15 @@ You can also specify validation using
146146
exception of the following query operators: :query:`$near`,
147147
:query:`$nearSphere`, :query:`$text`, and :query:`$where`.
148148

149-
.. code-block:: json
149+
.. code-block:: javascript
150150

151151
{
152152
$or: [
153-
{ "name": { $type: "string" } },
154-
{ "borough": {
155-
"bsonType": "string",
156-
"enum": [ "Manhattan", "Brooklyn", "Queens", "Bronx", "Staten Island" ],
157-
"description": "must be one of the enum strings"
153+
{ name: { $type: "string" } },
154+
{ borough: {
155+
bsonType: "string",
156+
enum: [ "Manhattan", "Brooklyn", "Queens", "Bronx", "Staten Island" ],
157+
description: "must be one of the enum strings"
158158
} }
159159
]
160160
}

0 commit comments

Comments
 (0)