Send feedback
firebase_functions.firestore_fn module
Stay organized with collections
Save and categorize content based on your preferences.
Module for Cloud Functions that are triggered by Firestore.
Classes
Event class firebase_functions.firestore_fn. Event ( specversion : str , id : str , source : str , type : str , time : datetime , data : T , subject : str | None , location : str , project : str , database : str , namespace : str , document : str , params : dict[ str, str] )
Bases: CloudEvent
[T
]
A CloudEvent that contains a DocumentSnapshot
or a Change<DocumentSnapshot>
.
database : str
The Firestore database.
document : str
The document path.
location : str
The location of the database.
namespace : str
The Firestore namespace.
params : dict [ str , str ]
An dict containing the values of the path patterns.
Only named capture groups are populated - {key}, {key=*}, {key=**}
project : str
The project identifier.
Functions
on_document_created firebase_functions.firestore_fn. on_document_created ( ** kwargs ) → Callable[ [ Callable[ [ Event [ DocumentSnapshot | None] ] , None] ] , Callable[ [ Event [ DocumentSnapshot | None] ] , None] ]
Event handler that triggers when a document is created in Firestore.
Example:
@on_document_created ( document = "*" )
def example ( event : Event [ DocumentSnapshot ]):
pass
Parameters:
**kwargs (as firebase_functions.options.FirestoreOptions
) -- Firestore options.
Return type:
typing.Callable
[ [ firebase_functions.firestore_fn.Event
[
object
] ], None ]
A function that takes a Firestore event and returns None
.
on_document_deleted firebase_functions.firestore_fn. on_document_deleted ( ** kwargs ) → Callable[ [ Callable[ [ Event [ DocumentSnapshot | None] ] , None] ] , Callable[ [ Event [ DocumentSnapshot | None] ] , None] ]
Event handler that triggers when a document is deleted in Firestore.
Example:
@on_document_deleted ( document = "*" )
def example ( event : Event [ DocumentSnapshot ]) -> None :
pass
Parameters:
**kwargs (as firebase_functions.options.FirestoreOptions
) -- Firestore options.
Return type:
typing.Callable
[ [ firebase_functions.firestore_fn.Event
[
object
] ], None ]
A function that takes a Firestore event and returns None
.
on_document_updated firebase_functions.firestore_fn. on_document_updated ( ** kwargs ) → Callable[ [ Callable[ [ Event [ Change [ DocumentSnapshot | None] ] ] , None] ] , Callable[ [ Event [ Change [ DocumentSnapshot | None] ] ] , None] ]
Event handler that triggers when a document is updated in Firestore.
Example:
@on_document_updated ( document = "*" )
def example ( event : Event [ Change [ DocumentSnapshot ]]) -> None :
pass
Parameters:
**kwargs (as firebase_functions.options.FirestoreOptions
) -- Firestore options.
Return type:
typing.Callable
[ [ firebase_functions.firestore_fn.Event
[
firebase_functions.db.Change
] ], None ]
A function that takes a Firestore event and returns None
.
on_document_written firebase_functions.firestore_fn. on_document_written ( ** kwargs ) → Callable[ [ Callable[ [ Event [ Change [ DocumentSnapshot | None] ] ] , None] ] , Callable[ [ Event [ Change [ DocumentSnapshot | None] ] ] , None] ]
Event handler that triggers when a document is created, updated, or deleted in Firestore.
Example:
@on_document_written ( document = "*" )
def example ( event : Event [ Change [ DocumentSnapshot ]]) -> None :
pass
Parameters:
**kwargs (as firebase_functions.options.FirestoreOptions
) -- Firestore options.
Return type:
typing.Callable
[ [ firebase_functions.firestore_fn.Event
[
firebase_functions.db.Change
] ], None ]
A function that takes a Firestore event and returns None
.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-06 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?