Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
How can I change values in a Firestore document from the .onCreate function and return them to a user

I'm trying to change/create some values within a firestore document from a firebase cloud function and cant figure it out, probably missing something very easy.

exports.onEnterDetails = functions.firestore.document('accounts/{accountId}')
    .onCreate((snapshot, context) => {
        // grab values from the document
        const values = snap.data();
        // do stuff with the values the user put in
        ...
    })

How can I change the value/create new entries in the same firestore document, and how can i return some of those new entries to the user on the front end (website)?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your onCreate Cloud Function is trigged asynchronously, after the document was already created in Firestore. There is no way at that point anymore to change the initial data in the document, nor is there any way to return data to the client that created the document.

If you want a synchronous flow where you modify the data before it is written, and can respond to the client, consider implementing a Callable Cloud Function or a HTTP cloud function, both of which are synchronous. In either of these you call the Cloud Function from your application code and pass the data with that call, instead of writing it to Firestore directly. The Cloud Function then makes the call to Firestore and returns the necessary result to the caller.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!