firestore.DocumentBuilder class

Signature:

export declare class DocumentBuilder<Path extends string> 

Constructors

Constructor Modifiers Description
(constructor)(triggerResource, options) Constructs a new instance of the DocumentBuilder class

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.(constructor)

Constructs a new instance of the DocumentBuilder class

Signature:

constructor(triggerResource: () => string, options: DeploymentOptions);

Parameters

Parameter Type Description
triggerResource () => string
options DeploymentOptions

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>>