Skip to main content

Document

The primary interaction point for managing a specfic piece of data.

info

See examples/databasing for getting started with databasing.

warning

You should never need to construct a document manually. Please utilize Modal#write to make a new document.

Constructor​

new Document(modal, id, data);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
modalModalundefinedModal constructor (handler of documents).
idstring❌undefinedDocument id.
dataobject❌undefinedPrevious data.
note

Data is augmented into the document class once constructed. We use typescript to type all the properties defined in the schema blueprint; which is the parent of modal which is the parent of documents.

Methods​

retrieveKnownInternalData​

Returns an object containing a copy of non mutated data since the last save.

retrieveKnownInternalData();

Returns​

object


asObject​

Returns a sanitized object of the document.

asObject();

Returns​

object


getId​

Returns the documents id.

getId();

Returns​

string


delete​

Deletes the document.

delete();

Returns​

void


save​

Saves any changes to the augmented data to persistent storage.

save();

Returns​

this