Skip to content

Commit 4a73dbf

Browse files
authored
DOCSP-41772-export-schema (#731)
* DOCSP-48249-export-schema * external review * rev * external review * external review * external review * internal review * internal review * cleans up warnings
1 parent a825e5a commit 4a73dbf

10 files changed

+415
-374
lines changed
178 KB
Loading
116 KB
Loading

source/includes/addl-json-fields.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is not an exhaustive list of all possible fields. For details on
2+
additional fields, see the
3+
`official JSON Schema spec <https://json-schema.org/draft/2020-12>`_.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
.. code-block:: json
2+
:linenos:
3+
:copyable: false
4+
5+
{
6+
"type": "object",
7+
"x-bsonType": "object",
8+
"required": [
9+
"_id",
10+
"title",
11+
"year"
12+
],
13+
"properties": {
14+
"_id": {
15+
"$ref": "#/$defs/ObjectId",
16+
"x-bsonType": "objectId",
17+
"x-metadata": {
18+
"hasDuplicates": false,
19+
"probability": 1,
20+
"count": 3
21+
},
22+
"x-sampleValues": [
23+
"573a1391f29313caabcd7616",
24+
"573a1392f29313caabcd9c1b",
25+
"573a1390f29313caabcd6223"
26+
]
27+
},
28+
"genres": {
29+
"type": "array",
30+
"x-bsonType": "array",
31+
"x-metadata": {
32+
"hasDuplicates": true,
33+
"probability": 0.3333333333333333,
34+
"count": 1
35+
},
36+
"items": {
37+
"type": "string",
38+
"x-bsonType": "string",
39+
"x-metadata": {
40+
"hasDuplicates": false,
41+
"probability": 1,
42+
"count": 2
43+
},
44+
"x-sampleValues": [
45+
"drama",
46+
"horror"
47+
]
48+
}
49+
},
50+
"plot": {
51+
"type": "string",
52+
"x-bsonType": "string",
53+
"x-metadata": {
54+
"hasDuplicates": false,
55+
"probability": 0.6666666666666666,
56+
"count": 2
57+
},
58+
"x-sampleValues": [
59+
"Salome, the daughter of Herodias, seduces her step-father/uncle Herod, ...",
60+
"Gwen's family is rich, but her parents ignore her and most of the serv..."
61+
]
62+
},
63+
"title": {
64+
"type": "string",
65+
"x-bsonType": "string",
66+
"x-metadata": {
67+
"hasDuplicates": false,
68+
"probability": 1,
69+
"count": 3
70+
},
71+
"x-sampleValues": [
72+
"Salomè",
73+
"Payment Deferred",
74+
"The Poor Little Rich Girl"
75+
]
76+
},
77+
"year": {
78+
"type": "integer",
79+
"x-bsonType": "int",
80+
"x-metadata": {
81+
"hasDuplicates": false,
82+
"probability": 1,
83+
"count": 3
84+
},
85+
"x-sampleValues": [
86+
1922,
87+
1932,
88+
1917
89+
]
90+
}
91+
},
92+
"$defs": {
93+
"ObjectId": {
94+
"type": "object",
95+
"properties": {
96+
"$oid": {
97+
"type": "string",
98+
"pattern": "^[0-9a-fA-F]{24}$"
99+
}
100+
},
101+
"required": [
102+
"$oid"
103+
],
104+
"additionalProperties": false
105+
}
106+
}
107+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. code-block:: json
2+
:linenos:
3+
:copyable: false
4+
5+
{
6+
"$jsonSchema": {
7+
"bsonType": "object",
8+
"required": [
9+
"_id",
10+
"title",
11+
"year"
12+
],
13+
"properties": {
14+
"_id": {
15+
"bsonType": "objectId"
16+
},
17+
"genres": {
18+
"bsonType": "array",
19+
"items": {
20+
"bsonType": "string"
21+
}
22+
},
23+
"plot": {
24+
"bsonType": "string"
25+
},
26+
"title": {
27+
"bsonType": "string"
28+
},
29+
"year": {
30+
"bsonType": "int"
31+
}
32+
}
33+
}
34+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. code-block:: json
2+
:linenos:
3+
:copyable: false
4+
5+
{
6+
"$schema": "https://json-schema.org/draft/2020-12/schema",
7+
"type": "object",
8+
"required": [
9+
"_id",
10+
"title",
11+
"year"
12+
],
13+
"properties": {
14+
"_id": {
15+
"$ref": "#/$defs/ObjectId"
16+
},
17+
"genres": {
18+
"type": "array",
19+
"items": {
20+
"type": "string"
21+
}
22+
},
23+
"plot": {
24+
"type": "string"
25+
},
26+
"title": {
27+
"type": "string"
28+
},
29+
"year": {
30+
"type": "integer"
31+
}
32+
},
33+
"$defs": {
34+
"ObjectId": {
35+
"type": "object",
36+
"properties": {
37+
"$oid": {
38+
"type": "string",
39+
"pattern": "^[0-9a-fA-F]{24}$"
40+
}
41+
},
42+
"required": [
43+
"$oid"
44+
],
45+
"additionalProperties": false
46+
}
47+
}
48+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Expanded format schema objects contain these fields in addition to the
2+
Standard Schema fields:
3+
4+
.. list-table::
5+
:header-rows: 1
6+
:widths: 35 25 40
7+
8+
* - Property
9+
- Data type
10+
- Description
11+
12+
* - ``x-bsonType``
13+
- string or array
14+
- |bson| type of this field.
15+
16+
* - ``x-metadata``
17+
- document
18+
- Document containing metadata about the field.
19+
20+
* - ``hasDuplicates``
21+
- boolean
22+
- ``true`` if a single value appears multiple times in this
23+
field. Otherwise ``false``.
24+
25+
* - ``probability``
26+
- float
27+
- Probability that the field exists in a random document.
28+
29+
* - ``count``
30+
- integer
31+
- Number of documents from the sample that have this field.
32+
33+
* - ``x-sampleValues``
34+
- array
35+
- Sample values as Expanded JSON. Sample values are limited to
36+
the first 100 characters.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
MongoDB format schema objects contain the following fields:
2+
3+
.. list-table::
4+
:header-rows: 1
5+
:widths: 35 25 40
6+
7+
* - Property
8+
- Data type
9+
- Description
10+
11+
* - ``bsonType``
12+
- string or array of strings
13+
- |bson| type of this field.
14+
15+
* - ``required``
16+
- array of strings
17+
- Fields that must appear in the schema.
18+
19+
* - ``properties``
20+
- document
21+
- Properties for each field. Keys are property names and values are
22+
subschemas.
23+
24+
* - ``items``
25+
- document
26+
- Metadata about elements in array fields. Metadata appears as
27+
embedded subschemas.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Standard format schema objects contain the following fields:
2+
3+
.. list-table::
4+
:header-rows: 1
5+
:widths: 35 25 40
6+
7+
* - Property
8+
- Data type
9+
- Description
10+
11+
* - ``type``
12+
- string or array
13+
- JSON type of this data type. For details, see the `official JSON
14+
docs for type <https://json-schema.org/draft/2020-12/json-schema-validation#name-type>`_.
15+
16+
* - ``required``
17+
- array of strings
18+
- Fields that must appear in the schema. For details, see the
19+
`official JSON docs for required <https://json-schema.org/draft/2020-12/json-schema-validation#name-required>`_.
20+
21+
* - ``properties``
22+
- object
23+
- Properties for each field. Keys are property names and values are
24+
subschemas. For details, see the `official JSON docs for properties
25+
<https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.1>`_.
26+
27+
* - ``items``
28+
- document
29+
- Metadata about elements in array fields. Metadata appears as
30+
embedded subschemas. For details, see the `official
31+
JSON docs for items <https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.1.2>`_.
32+

0 commit comments

Comments
 (0)