Why 1 document write in Firestore costs +30 reads? [duplicate]

徘徊边缘 提交于 2020-06-21 05:44:52

问题


I am using Firebase Firestore to create a log system. The structure is:

  • collection: errors
    • entry for error 1
    • entry for error 2
    • ...

I add an error like so:

val error = hashMapOf(
    "datetime" to FieldValue.serverTimestamp(),
    "errorMessage" to errorMessage
)

database.collection("errors")
    .add(error)

Then I watch at how the costs are affected by this operation. Regarding the write count, it obviously adds 1 write operation.

The problem comes with the read operations. For some reason, executing this code causes:

  • More than 30 reads
  • The read count keep increasing as the time pases, even if I kill the app.

Why a write operation cost so many read operations?


回答1:


Note that if you are monitoring/watching your database through the Firebase console, the Firestore documents reads from the Firebase console are included in your Firestore read count/quota.



来源:https://stackoverflow.com/questions/62229630/why-1-document-write-in-firestore-costs-30-reads

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!