Skip to main content

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.

ValueExample
JSON object{"min": -2.5, "max": 24.1}

Settings

SettingMeaning
propertiesThe definitions of the nested properties, with the same settings as top-level properties.
additionalPropertiesWhat the object accepts besides its properties: true anything, false nothing, or a definition (e.g. {"type": "number"}) which every further property has to match. The definition must not be an object or a vector. Default: false in strict schemas, true otherwise.

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

DatabaseStored asNotes
MongoDBembedded document(default), the only option
Neo4jnot supportedNeo4j has no nested values, "storage": "graph" is rejected
Elasticsearchobject, with the mapping of the nested properties; "additionalProperties": false maps it dynamic: strictsearch copy

The search copy is written unless the property or the type sets "search": false. Where a property is stored is explained in placement.

Indices

None for the object itself. Nested properties can have every intent, they are indexed in MongoDB by their path, see nested properties.

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 databases.

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
}
}
}