There is no increment sentinel in the library — ArrayUnion, ArrayRemove, and Delete exist as sentinel classes, but atomic counter updates require dropping to the raw SDK's FieldValue.increment().
Motivation
Atomic increments are a common Firestore pattern (counters, balances, usage tracking), and today every use forces a raw getFirestore().update(...) escape hatch outside the typed repository layer.
Suggested shape
Following the existing sentinel pattern:
- An
Increment sentinel class + increment(n) constructor alongside the existing field sentinels
- Converter support in the admin and client layers mapping it to
FieldValue.increment(n)
- A
Firestore.WithIncrementField (or similar) model helper in the style of WithArrayFields, so the sentinel is accepted on number fields in the update variant and flows through Repository.update with full typing
There is no
incrementsentinel in the library —ArrayUnion,ArrayRemove, andDeleteexist as sentinel classes, but atomic counter updates require dropping to the raw SDK'sFieldValue.increment().Motivation
Atomic increments are a common Firestore pattern (counters, balances, usage tracking), and today every use forces a raw
getFirestore().update(...)escape hatch outside the typed repository layer.Suggested shape
Following the existing sentinel pattern:
Incrementsentinel class +increment(n)constructor alongside the existing field sentinelsFieldValue.increment(n)Firestore.WithIncrementField(or similar) model helper in the style ofWithArrayFields, so the sentinel is accepted on number fields in theupdatevariant and flows throughRepository.updatewith full typing