Harry T.
Harry T.

Reputation: 3527

Does Firebase charge for document writes that don't actually change any field values?

I have to update app version on Firestore on a field named appVersion in a document named userA. I update appVersion to Firestore and don't care about remote appVersion.

Will Firebase charge me money if remote appVersion equals local appVersion? Thanks.

EDIT: I'm using Blaze plan which I have to pay $0.18/100K. Look like it small but for huge users that is not.

I have a Firestore database like this. enter image description here I used this code in Android/Java to update appVersion:

String appVersion = "2.0.0";
App.getInstance().mFirestoreUsers
   .document("GgRu62z0b2CgQFbgNebe")
   .update("appVersion", appVersion)
   .addOnSuccessListener(aVoid -> {
      LogWrapper.i(TAG, "update appversion complete: " + appVersion);
 });

What i want to ask is, if user document on Firestore has appVersion value is "2.0.0" and i use above code to send the same value, will Firebase count up 1 write or 0?

Upvotes: 7

Views: 1254

Answers (2)

Alex Mamo
Alex Mamo

Reputation: 138824

Because you are asking if you are charged even if you update a property within a document with the exact same data, the answer is yes. It doesn't really matter if you update a document with different data or with the exact same data, you'll always be charged with a write operation. An update with the same data, is basically considered an update too. So you'll be charged for that.

Upvotes: 3

gso_gabriel
gso_gabriel

Reputation: 4660

As per the Usage and limits documentation, the below are the free quota limits:

Free Quotas

Related to your question, yes, it will charge, since it's a new write to the database. It won't matter if you are just writing again the same value or a new one. Firestore won't check if the value is the same or not, it will charge per writing on the database.

In addition to that, I would recommend you to look at the documentation See a Cloud Firestore pricing example, for you to check how it's charged and the pricing works on Firestore. Besides that, it provides some examples of how to calculate, for you to check it.

Let me know if the information helped you!

Upvotes: 5

Related Questions