firestore.DocumentBuilder class

Signature:

export declare class DocumentBuilder<Path extends string> 

Methods

Method Modifiers Description
onCreate(handler) Respond only to document creations.
onDelete(handler) Respond only to document deletions.
onUpdate(handler) Respond only to document updates.
onWrite(handler) Respond to all document writes (creates, updates, or deletes).

firestore.DocumentBuilder.onCreate()

Respond only to document creations.

Signature:

onCreate(handler: (snapshot: QueryDocumentSnapshot, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any): CloudFunction<QueryDocumentSnapshot>;

Parameters

Parameter Type Description
handler (snapshot: QueryDocumentSnapshot, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any

Returns:

CloudFunction<QueryDocumentSnapshot>

firestore.DocumentBuilder.onDelete()

Respond only to document deletions.

Signature:

onDelete(handler: (snapshot: QueryDocumentSnapshot, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any): CloudFunction<QueryDocumentSnapshot>;

Parameters

Parameter Type Description
handler (snapshot: QueryDocumentSnapshot, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any

Returns:

CloudFunction<QueryDocumentSnapshot>

firestore.DocumentBuilder.onUpdate()

Respond only to document updates.

Signature:

onUpdate(handler: (change: Change<QueryDocumentSnapshot>, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any): CloudFunction<Change<QueryDocumentSnapshot>>;

Parameters

Parameter Type Description
handler (change: Change<QueryDocumentSnapshot>, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any

Returns:

CloudFunction<Change<QueryDocumentSnapshot>>

firestore.DocumentBuilder.onWrite()

Respond to all document writes (creates, updates, or deletes).

Signature:

onWrite(handler: (change: Change<DocumentSnapshot>, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any): CloudFunction<Change<DocumentSnapshot>>;

Parameters

Parameter Type Description
handler (change: Change<DocumentSnapshot>, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any

Returns:

CloudFunction<Change<DocumentSnapshot>>