UNPKG

voluptasmollitia

Version:
31 lines (17 loc) 1.4 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@firebase/firestore](./firestore.md) &gt; [/](./firestore_.md) &gt; [increment](./firestore_.increment.md) ## increment() function Returns a special value that can be used with [setDoc()](./firestore_lite.setdoc.md) or [updateDoc()](./firestore_lite.updatedoc.md) that tells the server to increment the field's current value by the given value. If either the operand or the current field value uses floating point precision, all arithmetic follows IEEE 754 semantics. If both values are integers, values outside of JavaScript's safe number range (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`<!-- -->) are also subject to precision loss. Furthermore, once processed by the Firestore backend, all integer operations are capped between -2^63 and 2^63-1. If the current field value is not of type `number`<!-- -->, or if the field does not yet exist, the transformation sets the field to the given value. <b>Signature:</b> ```typescript export declare function increment(n: number): FieldValue; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | n | number | The value to increment by. | <b>Returns:</b> [FieldValue](./firestore_.fieldvalue.md) The `FieldValue` sentinel for use in a call to `setDoc()` or `updateDoc()`