Object
object holds a JSON object, whose properties can be defined by the schema as well. Objects can be nested without a limit of the API.
| Value | Example |
|---|---|
| JSON object | {"min": -2.5, "max": 24.1} |
Settings
Keys of objects are never null: setting a key to null removes it.
In a strict schema, objects only accept their defined properties, on every level and also inside lists, like the schema itself only accepts defined properties. An object which holds free data, e.g. {"type": "object"} for arbitrary metadata, needs "additionalProperties": true there. The default only concerns the validation of the API: the MongoDB validator and the Elasticsearch mapping only restrict objects with an explicit "additionalProperties": false.
Storage
| Database | Stored as | Notes |
|---|---|---|
| MongoDB | embedded document | (default), the only option |
| Neo4j | not supported | Neo4j has no nested values, "storage": "graph" is rejected |
| Elasticsearch | object, with the mapping of the nested properties; "additionalProperties": false maps it dynamic: strict | search copy |
The search is written unless the property or the type sets "search": false. Where a property is stored is explained in .
Indices
None for the object itself. Nested properties can have every intent, they are indexed in MongoDB by their path, see nested .
Limits
MongoDB stores at most 100 levels of nesting and 16 MB per document, Elasticsearch maps at most 20 levels (index.mapping.depth.limit) and 1000 fields per index, see .
Example
Schema:
{ "type": "object", "properties": { "min": { "type": "number", "required": true }, "max": { "type": "number" } }, "additionalProperties": false}Input and output:
{ "data": { "temperature": { "min": -2.5, "max": 24.1 } }}