Search…
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[]=_idJSON
1
{
2
"_id": "5516ee1b34d8d934281699e3",
3
"object": "org",
4
"roles": [{
5
"_id": "000000000000000000000004"
6
}, {
7
"_id": "000000000000000000000005"
8
}, {
9
"_id": "000000000000000000000007"
10
}]
11
}
Copied!
Notice the use of a relative path to the org roles identifiers in the query (paths[]=_id). Selection using paths, include and expand all work in this way.
An example of a non-array Document is the Account name property, having first and last child properties.
GET /accounts/meJSON
1
{
2
"_id": "5516ee2634d8d93428169c0e",
3
"object": "account",
4
"name": {
5
"first": "Jonas",
6
"last": "Salk"
7
}
8
}
Copied!
When ACLs and filters are applied at the document level, they affect access to all its children.

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_heartrateJSON
1
{
2
"body": [{
3
"name": "c_datapoint",
4
"c_value": 65
5
}]
6
}
Copied!
When updating a document array that has a discriminator, the _id of the segment is sufficient:
PUT /551f3a95b8b206e835950b6bJSON
1
{
2
"body": [{
3
"_id": "551f3aa2b8b206e835950b6d",
4
"c_value": 67
5
}]
6
}
Copied!

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 modified 2mo ago
Copy link