Q:

Is it possible to set a maximum value for a number field in Firestore?

I want to increment a field saved in Firestore, but it should not exceed a certain value. 
Is it possible to set a maximum value for a field?
If not, what's the preferred way to implement such a limit in Kotlin?

A:

If you're asking about FieldValue.increment(), it's not possible.  You should instead use a transaction to read the document, compute a new value within appropriate limits, then write it back to the document.
If you're asking if it's possible to reject bad values altogether, no matter how they got written, you can do that with security rules, assuming that the write is coming from a web or mobile client.  Backend code bypasses security rules.

