Interface: DocumentCopy

ReactiveDb.DocumentCopy

Represents the result of a querying a single document from the ReactiveDb database (typically using the ReactiveDb#findOne, ReactiveDb#findOneLocally or ReactiveDb#findOneRemotely methods).

It simply extends the Document interface with the fromServer property.

Extends

Members

(readonly) acked :ReactiveDb.Document.AcknowledgementStatus

Gives the acknowledgement status of the document.

Type:
Inherited From:

(readonly, nullable) createdAt :Date

Gives the creation date of the document, if this instance represents an existing document.

Type:
  • Date
Inherited From:

(readonly) exists :boolean

Indicates whether this instance represents an existing document.

Type:
  • boolean
Inherited From:

(readonly) fromServer :boolean

Indicates whether this query result comes from the Webcom back end (true) or the local cache (false).

Type:
  • boolean

(readonly) id :string

Gets the identifier of the document.

Type:
  • string
Inherited From:

(readonly, nullable) updatedAt :Date

Gives the date of the last modification of the document, if this instance represents an existing document.

Type:
  • Date
Inherited From:

(readonly, nullable) version :number

Gives the version of the document, if this instance represents an existing document.

Version is a positive integer number, which starts at 1 for newly created documents and is incremented at each update of the document.

Type:
  • number
Inherited From:

Methods

getData() → {ReactiveDb.JSONObject}

Gets the user content of this document as a pure JSON object.

Inherited From:
Returns:

A JSON object representing the content of this document or an empty object {} if this instance represents a non-existing document.

Type
ReactiveDb.JSONObject

getDataAs(type) → {T|undefined}

Gets the user content of this document and deserializes it into a given data type.

Parameters:
Name Type Description
type ReactiveDb.Deserializable

The target type, given as an object with a deserialize method of template type T.

Inherited From:
Returns:

An instance of the target type representing the content of this document or undefined if this instance represents a non-existing document.

Type
T | undefined

getDataAt(field) → (nullable) {ReactiveDb.JSONValue}

Gets the user content of this document at a given field as a pure JSON value.

Throws an exception if the given field refers to a metadata.

Parameters:
Name Type Description
field ReactiveDb.DocumentField

The targeted field of the document.

Inherited From:
Returns:

A JSON value representing the content of this document at the given field or undefined if this instance represents a non-existing document or a document without the targeted field.

Type
ReactiveDb.JSONValue

getDataAtAs(field, type) → {T|undefined}

Gets the user content of this document at a given field and deserializes it into a given data type.

Throws an exception if the given field refers to a metadata.

Parameters:
Name Type Description
field ReactiveDb.DocumentField

The targeted field of the document.

type ReactiveDb.Deserializable

The target type, given as an object with a deserialize method of template type T.

Inherited From:
Returns:

An instance of the target type representing the content of this document at the given field or undefined if this instance represents a non-existing document or a document without the targeted field.

Type
T | undefined

isEqual(other) → {boolean}

Checks whether this instance represents the same document as another given one.

Parameters:
Name Type Description
other ReactiveDb.Document

The document to compare to.

Inherited From:
Returns:
Type
boolean
deprecated
Authentication
ServerlessDb
ReactiveDb