Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda