Document
Property Type: document
A Document can act in two ways. When configured as an array, it is a collection of documents with shared properties. When not defined as an array, the document properties are implemented as children.
Documents whose definition is configured as an array have an _id
property which can be used to retrieve, update or remove individual documents from the array. For example, the Organization roles are defined as a document array. Retrieving the _id
of all org roles could be done as follows:
GET /orgs/5516ee1b34d8d934281699e3/roles?paths[]=_id
JSON
{
"_id": "5516ee1b34d8d934281699e3",
"object": "org",
"roles": [{
"_id": "000000000000000000000004"
}, {
"_id": "000000000000000000000005"
}, {
"_id": "000000000000000000000007"
}]
}
An example of a non-array Document is the Account name
property, having first
and last
child properties.
GET /accounts/me
JSON
{
"_id": "5516ee2634d8d93428169c0e",
"object": "account",
"name": {
"first": "Jonas",
"last": "Salk"
}
}
Discriminators
Some Document arrays contain a discriminator, such as Post and Comment bodies. Because these arrays carry documents with potentially varying properties, the name
property is used as a discriminator. When creating a Post, for example, the discriminator must be included in the json body.
POST /c_vads/551f3515b8b206e835950b59/posts/c_heartrate
JSON
{
"body": [{
"name": "c_datapoint",
"c_value": 65
}]
}
When updating a document array that has a discriminator, the _id
of the segment is sufficient:
PUT /551f3a95b8b206e835950b6b
JSON
{
"body": [{
"_id": "551f3aa2b8b206e835950b6d",
"c_value": 67
}]
}
Property Options
Name
Type
Description
properties
Property Definition Array
An array of property definitions. These can be properties of any type except Document.
Base property options not available:
uniqueValues
indexed
unique
auditable
Last updated
Was this helpful?