Global

Methods

setLogFunction()

Sets the log function for all active Firestore instances.

Source:

Type Definitions

DocumentData :Object.<string, *>

Document data (e.g. for use with set()) consisting of fields mapped to values.

Source:

documentSnapshotCallback(snapshot)

onSnapshot() callback that receives a DocumentSnapshot.

Parameters:
Name Type Description
snapshot DocumentSnapshot

A document snapshot.

Source:

errorCallback(err)

onSnapshot() callback that receives an error.

Parameters:
Name Type Description
err Error

An error from a listen.

Source:

Precondition :Object

An options object that configures conditional behavior of update() and delete() calls in DocumentReference, WriteBatch, and Transaction. Using Preconditions, these calls can be restricted to only apply to documents that match the specified conditions.

Properties:
Name Type Description
lastUpdateTime string

The update time to enforce (specified as an ISO 8601 string).

Source:
Example
const documentRef = firestore.doc('coll/doc');

documentRef.get().then(snapshot => {
  const updateTime = snapshot.updateTime;

  console.log(`Deleting document at update time: ${updateTime.toDate()}`);
  return documentRef.delete({ lastUpdateTime: updateTime });
});

querySnapshotCallback(snapshot)

onSnapshot() callback that receives a QuerySnapshot.

Parameters:
Name Type Description
snapshot QuerySnapshot

A query snapshot.

Source:

ReadOptions :Object

An options object that can be used to configure the behavior of getAll() calls. By providing a fieldMask, these calls can be configured to only return a subset of fields.

Properties:
Name Type Description
fieldMask Array.<(string|FieldPath)>

Specifies the set of fields to return and reduces the amount of data transmitted by the backend. Adding a field mask does not filter results. Documents do not need to contain values for all the fields in the mask to be part of the result set.

Source:

SetOptions :Object

An options object that configures the behavior of set() calls in DocumentReference, WriteBatch, and Transaction. These calls can be configured to perform granular merges instead of overwriting the target documents in their entirety by providing a SetOptions object with { merge : true }.

Properties:
Name Type Description
merge boolean

Changes the behavior of a set() call to only replace the values specified in its data argument. Fields omitted from the set() call remain untouched.

mergeFields Array.<(string|FieldPath)>

Changes the behavior of set() calls to only replace the specified field paths. Any field path that is not specified is ignored and remains untouched. It is an error to pass a SetOptions object to a set() call that is missing a value for any of the fields specified here.

Source:

UpdateData :Object.<string, *>

Update data (for use with update) that contains paths (e.g. 'foo' or 'foo.baz') mapped to values. Fields that contain dots reference nested fields within the document.

Source: