A single JSON document stored in a KongoDB database, exposed as both a Milton resource and a java.util.Map over its parsed JSON content so admin templates can read its properties directly. Its raw JSON is served on GET for REST clients, replaced on PUT, and updated or deleted through the exported update, save and delete methods for server-side JavaScript.
Group: Resources
Extends: AbstractJsonResource
Implements: ReplaceableResource, PostableResource, DeletableResource, ContentPermissionsResource, Map
Properties
| Property | Returns | Description |
|---|---|---|
| breadCrumbs | Map<String,String> | Breadcrumb trail for the admin page, covering the path from the root dashboard down to this document's database (root dashboard / JSON Databases / database / this document). The root dashboard entry and this document itself are prepended and appended by the admin theme, so only the intermediate database crumb is returned here, keyed by href with the crumb label as the value. |
| contentManagedPermissions | boolean | Whether this document's permissions are managed as content permissions. Always false, since a document's access is controlled by its database, not per-document. |
| createDate | Date | When this document was created. |
| databaseTitle | String | |
| docType | String | The document's type, used to group and select Elasticsearch index mappings for documents of this kind. |
| document | JsonDocument | The underlying persisted document entity this resource wraps. |
| empty | boolean | Whether this document's parsed JSON content has no properties. Also true if the document has no content or its content cannot be parsed. |
| json | String | Raw JSON content of this document, as stored. Returns null if the document has no content, or if its stored content is the literal placeholder value "undefed". |
| jsonObject | Map | This document's JSON content parsed into a map, cached after the first successful parse. Returns null if the document has no content, or if the content cannot be parsed as JSON. |
| modifiedBy | Profile | The profile that last modified this document. |
| modifiedDate | Date | When this document was last modified. |
| title | String | Display title for this document, formed by prefixing its name with "Document: ". |
Methods
getTitle() · getBreadCrumbs() · getDocType() · update(String json) · update(String json, String docType) · getJson() · getJsonObject() · delete() · getModifiedDate() · getCreateDate() · isContentManagedPermissions() · isEmpty() · save() · getModifiedBy() · getDocument()
getTitle()
Returns: String
Display title for this document, formed by prefixing its name with "Document: ".
getBreadCrumbs()
Returns: Map<String,String>
Breadcrumb trail for the admin page, covering the path from the root dashboard down to this document's database (root dashboard / JSON Databases / database / this document). The root dashboard entry and this document itself are prepended and appended by the admin theme, so only the intermediate database crumb is returned here, keyed by href with the crumb label as the value.
getDocType()
Returns: String
The document's type, used to group and select Elasticsearch index mappings for documents of this kind.
update(String json)
Returns: void
Replaces this document's content with the given JSON string, keeping its current document type. The document is re-indexed as part of the update.
| Parameter | Description |
|---|---|
json | the new JSON content, must be a non-blank object starting with "{" |
update(String json, String docType)
Returns: void
Replaces this document's content and document type. The document is re-indexed as part of the update.
| Parameter | Description |
|---|---|
json | the new JSON content |
docType | the new document type |
getJson()
Returns: String
Raw JSON content of this document, as stored. Returns null if the document has no content, or if its stored content is the literal placeholder value "undefed".
getJsonObject()
Returns: Map
This document's JSON content parsed into a map, cached after the first successful parse. Returns null if the document has no content, or if the content cannot be parsed as JSON.
delete()
Returns: void
Deletes this document and removes it from the database's search index.
getModifiedDate()
Returns: Date
When this document was last modified.
getCreateDate()
Returns: Date
When this document was created.
isContentManagedPermissions()
Returns: boolean
Whether this document's permissions are managed as content permissions. Always false, since a document's access is controlled by its database, not per-document.
isEmpty()
Returns: boolean
Whether this document's parsed JSON content has no properties. Also true if the document has no content or its content cannot be parsed.
save()
Returns: void
Writes any in-memory changes made to this document's parsed JSON content back to the database and search index, by serialising the parsed map and calling update.
getModifiedBy()
Returns: Profile
The profile that last modified this document.
getDocument()
Returns: JsonDocument
The underlying persisted document entity this resource wraps.