Writes to Firestore using a Workflows connector.
Code sample
YAML
What's next
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .
Writes to Firestore using a Workflows connector.
# This workflow demonstrates how to use the Firestore connector:
# Write data to a document in the default Firestore database
# Expected output: "projects/PROJECT_ID/databases/(default)/documents/peopleDatabase/smith.j"
-
init_variables
:
assign
:
-
project
:
${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
-
collection
:
"peopleDatabase"
-
document
:
"smith.j"
-
values_to_write
:
FirstName
:
stringValue
:
"John"
LastName
:
stringValue
:
"Smith"
Age
:
integerValue
:
32
-
write_to_firestore
:
call
:
googleapis.firestore.v1.projects.databases.documents.patch
args
:
name
:
${"projects/"+project+"/databases/(default)/documents/"+collection+"/"+document}
body
:
fields
:
${values_to_write}
result
:
write_result
-
last
:
return
:
${write_result.name}
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .
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.