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

264
Views
Firestore - does creating document reference count as 'read' or 'write'?

from the firestore doc

In some cases, it can be useful to create a document reference with an auto-generated ID, then use the reference later. For this use case, you can call doc().

import { collection, doc, setDoc } from "firebase/firestore"; 

// Add a new document with a generated id
const newCityRef = doc(collection(db, "cities"));

// later...
await setDoc(newCityRef, data);

Behind the scenes, .add(...) and .doc().set(...) are completely equivalent, so you can use whichever is more convenient.

my question is that does const newCityRef = doc(collection(db, "cities")); count as 'read' or 'write' without using setDoc(newCityRef, data)?

Let's say if I generate 100 document references but don't save them at all, my 'read' or 'write' count is 0 or 100?

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

0

No, you are charged only when you read or save data from Firestore. The references are just created by Firebase SDK on client side.

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!