Returns a special value that can be used with set(), create() or update() that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array.
Parameter
Name
Description
elements
unknown[]
The elements to remove from the array. {FieldValue} The FieldValue sentinel for use in a call to set(), create() or update().
letdocumentRef=firestore.doc('col/doc');documentRef.update('array',Firestore.FieldValue.arrayRemove('foo')).then(()=>{returndocumentRef.get();}).then(doc=>{// doc.get('array') no longer contains field 'foo'});
Returns a special value that can be used with set(), create() or update() that tells the server to union the given elements with any array value that already exists on the server. Each specified element that doesn't already exist in the array will be added to the end. If the field being modified is not already an array it will be overwritten with an array containing exactly the specified elements.
Parameter
Name
Description
elements
unknown[]
The elements to union into the array. {FieldValue} The FieldValue sentinel for use in a call to set(), create() or update().
letdocumentRef=firestore.doc('col/doc');documentRef.update('array',Firestore.FieldValue.arrayUnion('foo')).then(()=>{returndocumentRef.get();}).then(doc=>{// doc.get('array') contains field 'foo'});
delete()
staticdelete():FieldValue;
Returns a sentinel for use with update() or set() with {merge:true} to mark a field for deletion.
{FieldValue} The sentinel value to use in your objects.
Example
letdocumentRef=firestore.doc('col/doc');letdata={a:'b',c:'d'};documentRef.set(data).then(()=>{returndocumentRef.update({a:Firestore.FieldValue.delete()});}).then(()=>{// Document now only contains { c: 'd' }});
increment(n)
staticincrement(n:number):FieldValue;
Returns a special value that can be used with set(), create() or update() that tells the server to increment the the field's current value by the given value.
If either current field value or the operand uses floating point precision, both values will be interpreted as floating point numbers and all arithmetic will follow IEEE 754 semantics. Otherwise, integer precision is kept and the result is 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 will set the field to the given value.
Parameter
Name
Description
n
number
The value to increment by. {FieldValue} The FieldValue sentinel for use in a call to set(), create() or update().
letdocumentRef=firestore.doc('col/doc');documentRef.update('counter',Firestore.FieldValue.increment(1)).then(()=>{returndocumentRef.get();}).then(doc=>{// doc.get('counter') was incremented});
isEqual(other)
isEqual(other:firestore.FieldValue):boolean;
Returns true if this FieldValue is equal to the provided value.
Parameter
Name
Description
other
firestore.FieldValue
The value to compare against. {boolean} true if this FieldValue is equal to the provided value.
letdocumentRef=firestore.doc('col/doc');documentRef.set({time:Firestore.FieldValue.serverTimestamp()}).then(()=>{returndocumentRef.get();}).then(doc=>{console.log(`Server time set to ${doc.get('time')}`);});
vector(values)
staticvector(values?:number[]):VectorValue;
Creates a new VectorValue constructed with a copy of the given array of numbers.
Parameter
Name
Description
values
number[]
Create a VectorValue instance with a copy of this array of numbers.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Class FieldValue (7.11.0)\n\nVersion latestkeyboard_arrow_down\n\n- [7.11.0 (latest)](/nodejs/docs/reference/firestore/latest/firestore/fieldvalue)\n- [7.9.0](/nodejs/docs/reference/firestore/7.9.0/firestore/fieldvalue)\n- [7.7.0](/nodejs/docs/reference/firestore/7.7.0/firestore/fieldvalue)\n- [7.6.0](/nodejs/docs/reference/firestore/7.6.0/firestore/fieldvalue)\n- [7.5.0](/nodejs/docs/reference/firestore/7.5.0/firestore/fieldvalue)\n- [7.4.0](/nodejs/docs/reference/firestore/7.4.0/firestore/fieldvalue)\n- [7.3.1](/nodejs/docs/reference/firestore/7.3.1/firestore/fieldvalue)\n- [7.2.0](/nodejs/docs/reference/firestore/7.2.0/firestore/fieldvalue)\n- [7.1.0](/nodejs/docs/reference/firestore/7.1.0/firestore/fieldvalue)\n- [6.4.1](/nodejs/docs/reference/firestore/6.4.1/firestore/fieldvalue)\n- [6.3.0](/nodejs/docs/reference/firestore/6.3.0/firestore/fieldvalue)\n- [6.0.0](/nodejs/docs/reference/firestore/6.0.0/firestore/fieldvalue)\n- [5.0.2](/nodejs/docs/reference/firestore/5.0.2/firestore/fieldvalue)\n- [4.15.1](/nodejs/docs/reference/firestore/4.15.1/firestore/fieldvalue)\n- [4.14.2](/nodejs/docs/reference/firestore/4.14.2/firestore/fieldvalue)\n- [4.9.8](/nodejs/docs/reference/firestore/4.9.8/firestore/fieldvalue) \nSentinel values that can be used when writing documents with set(), create() or update().\n\nFieldValue\n\nPackage\n-------\n\n[@google-cloud/firestore](../overview.html)\n\nConstructors\n------------\n\n### (constructor)()\n\n constructor();\n\nConstructs a new instance of the `FieldValue` class\n\nMethods\n-------\n\n### arrayRemove(elements)\n\n static arrayRemove(...elements: unknown[]): FieldValue;\n\nReturns a special value that can be used with set(), create() or update() that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array.\n\n**Example** \n\n\n let documentRef = firestore.doc('col/doc');\n\n documentRef.update(\n 'array', Firestore.FieldValue.arrayRemove('foo')\n ).then(() =\u003e {\n return documentRef.get();\n }).then(doc =\u003e {\n // doc.get('array') no longer contains field 'foo'\n });\n\n### arrayUnion(elements)\n\n static arrayUnion(...elements: unknown[]): FieldValue;\n\nReturns a special value that can be used with set(), create() or update() that tells the server to union the given elements with any array value that already exists on the server. Each specified element that doesn't already exist in the array will be added to the end. If the field being modified is not already an array it will be overwritten with an array containing exactly the specified elements.\n\n**Example** \n\n\n let documentRef = firestore.doc('col/doc');\n\n documentRef.update(\n 'array', Firestore.FieldValue.arrayUnion('foo')\n ).then(() =\u003e {\n return documentRef.get();\n }).then(doc =\u003e {\n // doc.get('array') contains field 'foo'\n });\n\n### delete()\n\n static delete(): FieldValue;\n\nReturns a sentinel for use with update() or set() with {merge:true} to mark a field for deletion.\n\n**Example** \n\n\n let documentRef = firestore.doc('col/doc');\n let data = { a: 'b', c: 'd' };\n\n documentRef.set(data).then(() =\u003e {\n return documentRef.update({a: Firestore.FieldValue.delete()});\n }).then(() =\u003e {\n // Document now only contains { c: 'd' }\n });\n\n### increment(n)\n\n static increment(n: number): FieldValue;\n\nReturns a special value that can be used with set(), create() or update() that tells the server to increment the the field's current value by the given value.\n\nIf either current field value or the operand uses floating point precision, both values will be interpreted as floating point numbers and all arithmetic will follow IEEE 754 semantics. Otherwise, integer precision is kept and the result is capped between -2\\^63 and 2\\^63-1.\n\nIf the current field value is not of type 'number', or if the field does not yet exist, the transformation will set the field to the given value.\n\n**Example** \n\n\n let documentRef = firestore.doc('col/doc');\n\n documentRef.update(\n 'counter', Firestore.FieldValue.increment(1)\n ).then(() =\u003e {\n return documentRef.get();\n }).then(doc =\u003e {\n // doc.get('counter') was incremented\n });\n\n### isEqual(other)\n\n isEqual(other: firestore.FieldValue): boolean;\n\nReturns true if this `FieldValue` is equal to the provided value.\n\n**Example** \n\n\n let fieldValues = [\n Firestore.FieldValue.increment(-1.0),\n Firestore.FieldValue.increment(-1),\n Firestore.FieldValue.increment(-0.0),\n Firestore.FieldValue.increment(-0),\n Firestore.FieldValue.increment(0),\n Firestore.FieldValue.increment(0.0),\n Firestore.FieldValue.increment(1),\n Firestore.FieldValue.increment(1.0)\n ];\n\n let equal = 0;\n for (let i = 0; i \u003c fieldvalues.length;=\"\" ++i)=\"\" {=\"\" for=\"\" (let=\"\" j=\"i\" +=\"\" 1;=\"\" j=\"\"\u003e\u003c fieldvalues.length;=\"\" ++j)=\"\" {=\"\" if=\"\" (fieldvalues[i].isequal(fieldvalues[j]))=\"\" {=\"\" ++equal;=\"\" }=\"\" }=\"\" }=\"\" console.log(`found=\"\" ${equal}=\"\" equalities.`);=\"\"\u003e\n\n### serverTimestamp()\n\n static serverTimestamp(): FieldValue;\n\nReturns a sentinel used with set(), create() or update() to include a server-generated timestamp in the written data.\n\n{FieldValue} The FieldValue sentinel for use in a call to set(), create() or update().\n\n**Example** \n\n\n let documentRef = firestore.doc('col/doc');\n\n documentRef.set({\n time: Firestore.FieldValue.serverTimestamp()\n }).then(() =\u003e {\n return documentRef.get();\n }).then(doc =\u003e {\n console.log(`Server time set to ${doc.get('time')}`);\n });\n\n### vector(values)\n\n static vector(values?: number[]): VectorValue;\n\nCreates a new `VectorValue` constructed with a copy of the given array of numbers."]]