Reputation: 295
According to Firestore documentation, it is possible to update a single field without updating the entire document:
def update_create_if_missing():
db = firestore.Client()
city_ref = db.collection(u'cities').document(u'BJ')
city_ref.update({
u'capital': True
}, firestore.CreateIfMissingOption(True))
Are Firestore updates charged as writes?
Is there an option such as "update if different" instead of the current one which is updating if missing?
I have built quite a heavy price comparison application with more than 1 million products (each product is a document in Firestore) updated on a daily basis. It would be quite expensive if I had to pay 1.000.000 writes per day on top of the Firestore reads.
Is there any alternative I could explore?
Upvotes: 2
Views: 724
Reputation: 647
To add to Doug's answer, Firestore considers document creations, updates and even deletes as billable write events. Read up more on their official documentation here.
Upvotes: 1
Reputation: 317362
Firestore document updates are not different than writes. Any operation that changes a document is considered a write.
Upvotes: 3