FieldValue.min() and FieldValue.max()
Currently the Firestore API supports FieldValue.increment() to atomically increment or decrement a numeric value. I propose to add:
FieldValue.max(value): if the provided value is greater than the existing value on the server, then the field on the server takes this value. If it is less than the existing value, then the existing value remains.
FieldValue.min(value): (the opposite) if the provided value is less than the existing value on the server, then the field on the server takes this value. If it is greater than the existing value, then the existing value remains.
These operators should work on numeric fields AND Timestamp fields, maybe strings too?
-
Dennis Kugelmann commented
That would help us in a couple of cases, nice suggestion 👌