简体   繁体   中英

Regarding firebase reads and writes

I have some questions regarding firebase, which I think many of the beginners have. Let's say I have this query:-

var collecRef=FirebaseFirestore.instance.collection('aCollection').where("a"=="b").orderBy(//some more code);

If I execute this, how many reads will it cost? If:-

  1. There are 5 documents which match the condition (a==b)

  2. There are no documents which match the condition.

Now,

if I want to update the data in a document using setData() , with merge=true , would it cost a write? If data is intact? For example in a document I have saved the user name of a user and in my app, my users can change their names.

Now, If they try to update their name with ( setData() ), and they haven't entered a DIFFERENT NAME(the name is same), would it cost a write?

One document received from a query costs one read. That is all you need to know. The conditions don't matter, and the size of the collection doesn't matter. Just the number of documents received.

One call to setData costs one write. It doesn't matter what you write, or the current contents of the document.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM