Methods

delete

delete(documentRef) returns firebase.firestore.Transaction

Deletes the document referred to by the provided DocumentReference.

Parameter

documentRef

firebase.firestore.DocumentReference

A reference to the document to be deleted.

Value must not be null.

Returns

non-null firebase.firestore.Transaction This Transaction instance. Used for chaining method calls.

get

get(documentRef) returns Promise containing non-null firebase.firestore.DocumentSnapshot

Reads the document referenced by the provided DocumentReference.

Parameter

documentRef

firebase.firestore.DocumentReference

A reference to the document to be retrieved.

Value must not be null.

Returns

non-null Promise containing non-null firebase.firestore.DocumentSnapshot A promise of the read data in a DocumentSnapshot.

set

set(documentRef, data, options) returns firebase.firestore.Transaction

Writes to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created. If you pass options, the provided data can be merged into the existing document.

Parameter

documentRef

firebase.firestore.DocumentReference

A reference to the document to be created.

Value must not be null.

data

Object

An object of the fields and values for the document.

Value must not be null.

options

Optional

firebase.firestore.SetOptions

An object to configure the set behavior. Pass {merge: true} to only replace the values specified in the data argument. Fields omitted will remain untouched.

Value must not be null.

Returns

non-null firebase.firestore.Transaction This Transaction instance. Used for chaining method calls.

update

update(documentRef, ...var_args) returns firebase.firestore.Transaction

Updates fields in the document referred to by this DocumentReference. The update will fail if applied to a document that does not exist.

Nested fields can be updated by providing dot-separated field path strings or by providing FieldPath objects.

Parameter

documentRef

firebase.firestore.DocumentReference

A reference to the document to be updated.

Value must not be null.

var_args

any type

Either an object containing all of the fields and values to update, or a series of arguments alternating between fields (as string or firebase.firestore.FieldPath objects) and values.

Value may be repeated.

Returns

non-null firebase.firestore.Transaction This Transaction instance. Used for chaining method calls.