Furkan Sarihan
Furkan Sarihan

Reputation: 166

Is Firestore Server Timestamp update counting as new write operation?

I use Firestore ServerTimestamp in many documents.

With collection listeners, I can monitor that if a document has SeverTimestamp field value it’s updated twice, first one with ServerTimestamp value null.

I wonder that Is second document update counted when it comes to pricing?

Upvotes: 0

Views: 228

Answers (2)

Doug Stevenson
Doug Stevenson

Reputation: 317828

No, it's just one write.

What you're observing is the client listener being invoked twice, once when the timestamp is unknown, and again when the timestamp is known by the server and reflected back in the client. Just because the client listener is invoked twice, it doesn't mean there were two writes.

Upvotes: 2

Frank van Puffelen
Frank van Puffelen

Reputation: 600006

If you create or update a document with a server-side timestamp your client will see two events:

  1. The initial estimate of the client for the timestamp.
  2. The confirmed value from the server for the timestamp.

But there is only a single write operation that happens on the server, so you will only be charged for a single write.

Upvotes: 4

Related Questions