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

236
Views
Firebase Firestore - Can I perform normal reads inside transactions?

Can I do the following inside a transaction or might it cause unexpected errors?

module.exports = function updateUser(id, transaction) {
   // A query between writes
   const query = firestore
       .collection("users")
       .where("id", ==, id);

   const querySnapshot = await query.limit(1).get(); // <--- Only getting one doc

   transaction.update(...
}

....

return firestore.runTransaction(async (transaction) => {
   /* Transaction reads... */
   const a = transaction.get(...


   /* Transaction writes... */
   transaction.create(...

   await updateUser(ADMIN_ID, transaction); // <------ Implicit query
});

As I don't really care about the query target doc's modifications, I am performing the query without using "transaction", as it is not valid to perform queries using the Transaction object.

But, is this correct? Is it valid to execute a normal read after some transaction writes?

about 4 years ago · Juan Pablo Isaza
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!