Fired when the document is removed, regardless of whether the remover was local or remote.
Parameters:
args
- info object provided with the event. It has following properties:isLocal
- is true if document was removed by a local actor, false otherwisepreviousData
- contains a snapshot of the document data before removalFired when the document's contents have changed, regardless of whether the updater was local or remote.
Parameters:
args
- info object provided with the event. It has the following properties:isLocal
- is true if document was updated by a local actor, false otherwisedata
- a snapshot of the document's new contentspreviousData
- contains a snapshot of the document data before the updateThe contents of this document.
Date when the document was last updated.
The immutable identifier of this document, assigned by the system.
An optional immutable identifier that may be assigned by the programmer to this document during creation. Globally unique among other documents.
Conclude work with the document instance and remove all event listeners attached to it. Any subsequent operation on this object will be rejected with error. Other local copies of this document will continue operating and receiving events normally.
Schedules a modification to this document that will apply a mutation function.
A function that outputs new data based on the existing data. May be called multiple times, particularly if this document is modified concurrently by remote code. If the mutation ultimately succeeds, the document will have made the particular transition described by this function.
New document metadata.
Resolves with the most recent Document state, whether the output of a
successful mutation or a state that prompted graceful cancellation (mutator returned null
).
Delete a document.
A promise which resolves if (and only if) the document is ultimately deleted.
Assign new contents to this document. The current data will be overwritten.
The new contents to assign.
New document metadata.
A promise resolving to the new data of the document.
Update the time-to-live of the document.
Specifies the time-to-live in seconds after which the document is subject to automatic deletion. The value 0 means infinity.
A promise that resolves after the TTL update was successful.
Modify a document by appending new fields (or by overwriting existing ones) with the values from the provided Object. This is equivalent to:
document.mutate((currentValue) => Object.assign(currentValue, obj));
Specifies the particular (top-level) attributes that will receive new values.
New document metadata.
A promise resolving to the new data of the document.
Represents a Sync document, the contents of which is a single JSON object. Use the SyncClient.document method to obtain a reference to a Sync document. Information about rate limits can be found here.