Cloud Firestore: document whether calling `.onSnapshot` multiple times with the same query will have the reads be shared or not

It is unclear whether calling the method .onSnapshot(...) method, of the DocumentReference and Query types, multiple times and with the same “logical” query (i.e. not necessarily the same Query or DocumentSnapshot object, but with identical querying parameters) will:

  • multiply the amount of reads, or
  • have the optimization where the reads are shared among all listeners.

This is very useful information for properly minimizing the read cost and client network bandwidth usage.

1 possible answer(s) on “Cloud Firestore: document whether calling `.onSnapshot` multiple times with the same query will have the reads be shared or not

  1. @vinayluzrao If the multiple listeners are listening to the same collection, you will only be charged once for the read (assuming the underlying documents in the collection do not change). Adding additional onSnapshot listeners to that same collection will not cost you additional reads.