Is this operation:
db.collection("users").document(uid)
The same with:
db.collection("users").whereEqual("uid", uid)
If a specific uid does not exist, are we still charged with a read operation? Is this available in both cases? Note, that the document is not created yet, there is nothing that can be read.
This code:
db.collection("users").document(uid)
Does not cost any document reads. No document has been read yet. The only thing it does is build a DocumentReference object that can be used to get()
the document (or add a listener). The get()
costs a document read.
This code:
db.collection("users").whereEqual("uid", uid)
Also does not cost a document read until you call get()
(or add a listener). But if you do call get()
, then it will always cost at least one document read, even if no document is present. This is covered in the documentation for pricing :
There is a minimum charge of one document read for each query that you perform, even if the query returns no results.
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.