googleapis / googleapis/google-cloud-node
[FR] Add support for minimum and maximum field transforms
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
**Is your feature request related to a problem? Please describe.**
The _minimum_ and _maximum_ field transforms (which are available in the [REST API](https://firebase.google.com/docs/firestore/reference/rest/v1/Write#fieldtransform)) have not been implemented in the Firestore Node SDK
**Describe the solution you'd like**
I imagine the API for this would look very much like [`FieldValue.increment(...)`](https://firebase.google.com/docs/firestore/manage-data/add-data#increment_a_numeric_value), and would look something like:
```
// ...
const washingtonRef = db.collection('cities').doc('DC');
// Atomically set the value of population to the minimum of 50 or it's existing value
const res = await washingtonRef.update({
population: FieldValue.minimum(50)
});
```
**Describe alternatives you've considered**
n/a
**Additional context**
n/a
Contributor guide
Assessment
This issue has not been assessed yet.