A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/nodejs/docs/reference/firestore/latest/firestore/fieldvalue below:

Class FieldValue (7.11.0) | Node.js client library

Class FieldValue (7.11.0)

Stay organized with collections Save and categorize content based on your preferences.

Sentinel values that can be used when writing documents with set(), create() or update().

FieldValue

Package@google-cloud/firestore Constructors (constructor)()

Constructs a new instance of the FieldValue class

Methods arrayRemove(elements)
static arrayRemove(...elements: unknown[]): FieldValue;

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().

Example

let documentRef = firestore.doc('col/doc');

documentRef.update(
  'array', Firestore.FieldValue.arrayRemove('foo')
).then(() => {
  return documentRef.get();
}).then(doc => {
  // doc.get('array') no longer contains field 'foo'
});
arrayUnion(elements)
static arrayUnion(...elements: unknown[]): FieldValue;

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().

Example

let documentRef = firestore.doc('col/doc');

documentRef.update(
  'array', Firestore.FieldValue.arrayUnion('foo')
).then(() => {
  return documentRef.get();
}).then(doc => {
  // doc.get('array') contains field 'foo'
});
delete()
static delete(): FieldValue;

Returns a sentinel for use with update() or set() with {merge:true} to mark a field for deletion.

Returns Type Description FieldValue

{FieldValue} The sentinel value to use in your objects.

Example

let documentRef = firestore.doc('col/doc');
let data = { a: 'b', c: 'd' };

documentRef.set(data).then(() => {
  return documentRef.update({a: Firestore.FieldValue.delete()});
}).then(() => {
  // Document now only contains { c: 'd' }
});
increment(n)
static increment(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().

Example

let documentRef = firestore.doc('col/doc');

documentRef.update(
  'counter', Firestore.FieldValue.increment(1)
).then(() => {
  return documentRef.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.

Returns Type Description boolean Example

let fieldValues = [
  Firestore.FieldValue.increment(-1.0),
  Firestore.FieldValue.increment(-1),
  Firestore.FieldValue.increment(-0.0),
  Firestore.FieldValue.increment(-0),
  Firestore.FieldValue.increment(0),
  Firestore.FieldValue.increment(0.0),
  Firestore.FieldValue.increment(1),
  Firestore.FieldValue.increment(1.0)
];

let equal = 0;
for (let i = 0; i < fieldvalues.length;="" ++i)="" {="" for="" (let="" j="i" +="" 1;="" j="">< fieldvalues.length;="" ++j)="" {="" if="" (fieldvalues[i].isequal(fieldvalues[j]))="" {="" ++equal;="" }="" }="" }="" console.log(`found="" ${equal}="" equalities.`);="">
serverTimestamp()
static serverTimestamp(): FieldValue;

Returns a sentinel used with set(), create() or update() to include a server-generated timestamp in the written data.

{FieldValue} The FieldValue sentinel for use in a call to set(), create() or update().

Example

let documentRef = firestore.doc('col/doc');

documentRef.set({
  time: Firestore.FieldValue.serverTimestamp()
}).then(() => {
  return documentRef.get();
}).then(doc => {
  console.log(`Server time set to ${doc.get('time')}`);
});
vector(values)
static vector(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.

Returns Type Description VectorValue

A new VectorValue constructed with a copy of the given array of numbers.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4