Skip to content

Commit 09a21e4

Browse files
DOCSP-21988 doc for items value type (#251)
* DOCSP-21988 doc for items value type * Update source/reference/cli/sql/sqlsetschema.txt Copy review feedback Co-authored-by: zach-carr <[email protected]> * DOCSP-21988 update for review feedback Co-authored-by: zach-carr <[email protected]>
1 parent d947f6b commit 09a21e4

File tree

4 files changed

+40
-37
lines changed

4 files changed

+40
-37
lines changed

source/reference/cli/sql/sqlgenerateschema.txt

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,11 @@ more about the fields in the output, see
173173
"bsonType" : [
174174
"array"
175175
],
176-
"items" : [
177-
{
178-
"bsonType" : [
179-
"int"
180-
]
181-
}
182-
]
176+
"items" : {
177+
"bsonType" : [
178+
"int"
179+
]
180+
}
183181
}
184182
}
185183
}
@@ -261,22 +259,18 @@ more about the fields in the output, see
261259
]
262260
}
263261
},
264-
"items" : [
265-
{
266-
"bsonType" : [
267-
"int"
268-
]
269-
}
270-
]
262+
"items" : {
263+
"bsonType" : [
264+
"int"
265+
]
266+
}
271267
}
272268
},
273-
"items" : [
274-
{
275-
"bsonType" : [
276-
"int"
277-
]
278-
}
279-
]
269+
"items" : {
270+
"bsonType" : [
271+
"int"
272+
]
273+
}
280274
}
281275
}
282276
},

source/reference/cli/sql/sqlgetschema.txt

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,18 @@ information on the fields in the output, see
168168
]
169169
}
170170
},
171-
"items" : [
172-
{
173-
"bsonType" : [
174-
"int"
175-
]
176-
}
177-
]
171+
"items" : {
172+
"bsonType" : [
173+
"int"
174+
]
175+
}
178176
}
179177
},
180-
"items" : [
181-
{
182-
"bsonType" : [
183-
"int"
184-
]
185-
}
186-
]
178+
"items" : {
179+
"bsonType" : [
180+
"int"
181+
]
182+
}
187183
}
188184
}
189185
},

source/reference/cli/sql/sqlsetschema.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,14 @@ Parameters
7070
- document
7171
- The format version of the schema and the |json| schema to set
7272
the schema for the collection or view or an empty document to
73-
remove the schema for the collection or view.
73+
remove the schema for the collection or view.
74+
75+
.. note::
76+
77+
You can provide a single document or an array of documents
78+
in the ``items`` field. When you retrieve the schema,
79+
``items`` shows the form that you used to set the schema.
80+
7481
- Required
7582

7683
.. _sqlsetschema-output:
@@ -112,7 +119,7 @@ the ``egData`` collection.
112119

113120
.. code-block:: sh
114121

115-
db.runCommand({sqlSetSchema : "egData", "schema" : { "version" : NumberLong(1), "jsonSchema" : { "bsonType" : [ "object" ], "properties" : { "a" : { "bsonType" : [ "object" ], "properties" : { "b" : { "bsonType" : [ "object", "array" ], "properties" : { "c" : { "bsonType" : [ "array", "string", "object", "null" ], "properties" : { "d" : { "bsonType" : [ "int" ] } }, "items" : [ { "bsonType" : [ "int" ] } ] } }, "items" : [ { "bsonType" : [ "int" ] } ] } } }, "s" : { "bsonType" : [ "int", "object" ], "properties" : { "b" : { "bsonType" : [ "object" ], "properties" : { "c" : { "bsonType" : [ "object" ], "properties" : { "d" : { "bsonType" : [ "array" ], "items" : [ { "bsonType" : [ "string" ] } ] } } } } } } } } } }})
122+
db.runCommand({sqlSetSchema : "egData", "schema" : { "version" : NumberLong(1), "jsonSchema" : { "bsonType" : [ "object" ], "properties" : { "a" : { "bsonType" : [ "object" ], "properties" : { "b" : { "bsonType" : [ "object", "array" ], "properties" : { "c" : { "bsonType" : [ "array", "string", "object", "null" ], "properties" : { "d" : { "bsonType" : [ "int" ] } }, "items" : { "bsonType" : [ "int" ] } } }, "items" : { "bsonType" : [ "int" ] } } } }, "s" : { "bsonType" : [ "int", "object" ], "properties" : { "b" : { "bsonType" : [ "object" ], "properties" : { "c" : { "bsonType" : [ "object" ], "properties" : { "d" : { "bsonType" : [ "array" ], "items" : { "bsonType" : [ "string" ] } } } } } } } } } } }})
116123

117124
The previous command returns the following output.
118125

source/reference/format/sql-schema-format.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ Supported JSON Schema Fields
6868
- ``items``
6969
- ``properties``
7070

71+
.. note::
72+
73+
You can provide a single document or an array of documents for the
74+
``items`` field. When you retrieve the schema, the ``items`` field
75+
shows the form that you used for setting the schema.
76+
7177
To learn more about these fields, see :manual:`JSON Schema Keywords
7278
</reference/operator/query/jsonSchema/#jsonschema-keywords>`.
7379

0 commit comments

Comments
 (0)