Class: Document

Document

new Document()

Properties:
Name Type Description
ds ApiDataSource

The documents primary key

_fields array

The raw, unprocessed json response

id string

The documents primary key

raw string

The raw, unprocessed json response

Methods

create(skipRead){promise}

Creates an object by the default api.create

Name Type Description
skipRead

skips reading the response via _fromJson (false)

delete(){promise}

Deletes an object by the default api.delete

discardChanges(){promise}

Discards any changes made to the object from the previously loaded raw response or resets it when no old raw response was found

existsInDb(){boolean}

Checks if the document exists in the database

get(_fields){promise}

Gets an object by the default api.get

Name Type Description
_fields

isDirty(){boolean}

Checks if the object needs to be saved We don't check any of the keyvalues (or comments, attachments) here

isEmpty(){boolean}

Checks if the object is empty

isValid(){boolean}

Checks if the object is valid

reload(_fields){promise}

Reloads the object from db

Name Type Description
_fields

reset(){promise}

Resets the object

update(skipRead){promise}

Updates an object by the default api.update

Name Type Description
skipRead

skips reading the response via _fromJson (false)