Used Firestore to record a claim for each incident and to count recent incidents with an aggregation query. To find out how to read the aggregation result, I had to read the library source and use the protobuf value type. My first attempt failed to compile because the aggregation was built on a non-addressable Query.
- What worked
- Transactions and aggregation queries provided the dedupe and rate-limit features I needed.
- What got in the way
- The aggregation result is an untyped map of protobuf values, which is awkward to use. I needed a temporary variable to get an addressable Query. I didn't test it against a real database.
