firestore namespace

Functions

Function Description
onDocumentCreated(document, handler) Event handler which triggers when a document is created in Firestore.
onDocumentCreated(opts, handler) Event handler which triggers when a document is created in Firestore.
onDocumentDeleted(document, handler) Event handler which triggers when a document is deleted in Firestore.
onDocumentDeleted(opts, handler) Event handler which triggers when a document is deleted in Firestore.
onDocumentUpdated(document, handler) Event handler which triggers when a document is updated in Firestore.
onDocumentUpdated(opts, handler) Event handler which triggers when a document is updated in Firestore.
onDocumentWritten(document, handler) Event handler which triggers when a document is created, updated, or deleted in Firestore.
onDocumentWritten(opts, handler) Event handler which triggers when a document is created, updated, or deleted in Firestore.

Classes

Class Description
Change The Cloud Functions interface for events that change state, such as Realtime Database or Cloud Firestore onWrite and onUpdate events.For more information about the format used to construct Change objects, see below.

Interfaces

Interface Description
DocumentOptions DocumentOptions extend EventHandlerOptions with provided document and optional database and namespace.
FirestoreEvent A CloudEvent that contains a DocumentSnapshot or a Change

Type Aliases

Type Alias Description
DocumentSnapshot A Firestore DocumentSnapshot
QueryDocumentSnapshot A Firestore QueryDocumentSnapshot

firestore.onDocumentCreated()

Event handler which triggers when a document is created in Firestore.

Signature:

export declare function onDocumentCreated<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;

Parameters

Parameter Type Description
document Document The Firestore document path to trigger on.
handler (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> Event handler which is run every time a Firestore create occurs.

Returns:

CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>

firestore.onDocumentCreated()

Event handler which triggers when a document is created in Firestore.

Signature:

export declare function onDocumentCreated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;

Parameters

Parameter Type Description
opts DocumentOptions<Document> Options that can be set on an individual event-handling function.
handler (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> Event handler which is run every time a Firestore create occurs.

Returns:

CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>

firestore.onDocumentDeleted()

Event handler which triggers when a document is deleted in Firestore.

Signature:

export declare function onDocumentDeleted<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;

Parameters

Parameter Type Description
document Document The Firestore document path to trigger on.
handler (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> Event handler which is run every time a Firestore delete occurs.

Returns:

CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>

firestore.onDocumentDeleted()

Event handler which triggers when a document is deleted in Firestore.

Signature:

export declare function onDocumentDeleted<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;

Parameters

Parameter Type Description
opts DocumentOptions<Document> Options that can be set on an individual event-handling function.
handler (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any> Event handler which is run every time a Firestore delete occurs.

Returns:

CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>

firestore.onDocumentUpdated()

Event handler which triggers when a document is updated in Firestore.

Signature:

export declare function onDocumentUpdated<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;

Parameters

Parameter Type Description
document Document The Firestore document path to trigger on.
handler (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> Event handler which is run every time a Firestore update occurs.

Returns:

CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>

firestore.onDocumentUpdated()

Event handler which triggers when a document is updated in Firestore.

Signature:

export declare function onDocumentUpdated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;

Parameters

Parameter Type Description
opts DocumentOptions<Document> Options that can be set on an individual event-handling function.
handler (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> Event handler which is run every time a Firestore update occurs.

Returns:

CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>

firestore.onDocumentWritten()

Event handler which triggers when a document is created, updated, or deleted in Firestore.

Signature:

export declare function onDocumentWritten<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;

Parameters

Parameter Type Description
document Document The Firestore document path to trigger on.
handler (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> Event handler which is run every time a Firestore create, update, or delete occurs.

Returns:

CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>

firestore.onDocumentWritten()

Event handler which triggers when a document is created, updated, or deleted in Firestore.

Signature:

export declare function onDocumentWritten<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;

Parameters

Parameter Type Description
opts DocumentOptions<Document> Options that can be set on an individual event-handling function.
handler (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any> Event handler which is run every time a Firestore create, update, or delete occurs.

Returns:

CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>

firestore.DocumentSnapshot

A Firestore DocumentSnapshot

Signature:

export type DocumentSnapshot = firestore.DocumentSnapshot;

firestore.QueryDocumentSnapshot

A Firestore QueryDocumentSnapshot

Signature:

export type QueryDocumentSnapshot = firestore.QueryDocumentSnapshot;