Constructor

QueryDocumentSnapshot

new QueryDocumentSnapshot()

A QueryDocumentSnapshot contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with .data() or .get(<field>) to get a specific field.

A QueryDocumentSnapshot offers the same API surface as a DocumentSnapshot. Since query results contain only existing documents, the exists property will always be true and data() will never return undefined.

Extends
firebase.firestore.DocumentSnapshot

Methods

data

data(options) returns (firebase.firestore.Firestore~DocumentData or undefined)

Retrieves all fields in the document as an Object. Returns undefined if the document doesn't exist.

By default, FieldValue.serverTimestamp() values that have not yet been set to their final value will be returned as null. You can override this by passing an options object.

Parameter

options

Optional

An options object to configure how data is retrieved from the snapshot (e.g. the desired behavior for server timestamps that have not yet been set to their final value).

Value must not be null.

Inherited from
firebase.firestore.DocumentSnapshot#data
Returns

An object containing all fields in the specified document or 'undefined' if the document doesn't exist.

get

get(fieldPath, options) returns (any type or undefined)

Retrieves the field specified by fieldPath. Returns undefined if the document or field doesn't exist.

By default, a FieldValue.serverTimestamp() that has not yet been set to its final value will be returned as null. You can override this by passing an options object.

Parameter

fieldPath

The path (e.g. 'foo' or 'foo.bar') to a specific field.

options

Optional

An options object to configure how the field is retrieved from the snapshot (e.g. the desired behavior for server timestamps that have not yet been set to their final value).

Value must not be null.

Inherited from
firebase.firestore.DocumentSnapshot#get
Returns

The data at the specified field location or undefined if no such field exists in the document.

isEqual

isEqual(other) returns boolean

Returns 'true' if this DocumentSnapshot is equal to the provided one.

Parameter

other

The DocumentSnapshot to compare against.

Value must not be null.

Inherited from
firebase.firestore.DocumentSnapshot#isEqual
Returns

'true' if this DocumentSnapshot is equal to the provided one.