Skip to content

rpillala98/gcf_firestore_trigger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cloud Function Triggered by New Firestore Document

This demo code shows how to trigger a Google Cloud Function when a document is created in a specific collection in a specific database. The source code will also demonstrate how to access the content of the newly-created document.

Deploying the Cloud Function

The following command should be executed in the same Google Cloud Project as the Firestore database.

In this example, the cloud function will execute when a new document is added to the students collection in the (default) database.

gcloud functions deploy demo_firestore_trigger \
--entry-point demoFirestoreTrigger \
--runtime nodejs18 \
--trigger-event "providers/cloud.firestore/eventTypes/document.create" \
--trigger-resource "projects/sp24-41200-elliott-scratch/databases/(default)/documents/students/{pushId}" \
--no-gen2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%