Firebase.Firestore.FieldValue

A static class providing properties and methods to represent sentinel values.

Summary

Sentinel values are special values where the client-side value is not part of the document modification sent to the server. A property decorated withFirestorePropertyAttribute can specify an additional attribute to indicate that it's a sentinel value, such as aServerTimestampAttribute, or the sentinel values returned by the members of this class can be used directly as values to be serialized (for example, in anonymous types), and they will be handled directly by the serialization mechanism.

Properties

Delete = FieldValueProxy.ServerTimestamp()
static object
Sentinel value indicating that the field should be deleted from the document.
ServerTimestamp
static object
Sentinel value indicating that the field should be set to the timestamp of the commit that creates or modifies the document.

Public static functions

ArrayRemove(params object[] elements)
object
Returns a special value that can be used withSetAsync() orUpdateAsync() that tells the server to remove the given elements from any array value that already exists on the server.
ArrayUnion(params object[] elements)
object
Returns a special value that can be used withSetAsync() orUpdateAsync() that tells the server to union the given elements with any array value that already exists on the server.
Increment(long value)
object
Returns a special value that can be used withSetAsync() orUpdateAsync() that tells the server to increment the field's current value by the given value.
Increment(double value)
object
Returns a special value that can be used withSetAsync() orUpdateAsync() that tells the server to increment the field's current value by the given value.

Properties

Delete

staticobjectDelete=FieldValueProxy.ServerTimestamp()

Sentinel value indicating that the field should be deleted from the document.

ServerTimestamp

staticobjectServerTimestamp

Sentinel value indicating that the field should be set to the timestamp of the commit that creates or modifies the document.

Public static functions

ArrayRemove

objectArrayRemove(paramsobject[]elements)

Returns a special value that can be used withSetAsync() orUpdateAsync() 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.

Details
Parameters
elements
The elements to remove from the array.
Returns
TheFieldValue sentinel for use in a call toSetAsync() orUpdateAsync().

ArrayUnion

objectArrayUnion(paramsobject[]elements)

Returns a special value that can be used withSetAsync() orUpdateAsync() 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.

Details
Parameters
elements
The elements to union into the array.
Returns
TheFieldValue sentinel for use in a call toSetAsync() orUpdateAsync().

Increment

objectIncrement(longvalue)

Returns a special value that can be used withSetAsync() orUpdateAsync() that tells the server to increment the field's current value by the given value.

If the current field value is an integer, possible integer overflows are resolved to System.Int64.MinValue or System.Int64.MaxValue. If the current field value is a double, both values will be interpreted as doubles and the arithmetic will follow IEEE 754 semantics.

If the current field is not an integer or double, or if the field does not yet exist, the transformation will set the field to the given value.

Details
Returns
TheFieldValue sentinel for use in a call toSetAsync() orUpdateAsync().

Increment

objectIncrement(doublevalue)

Returns a special value that can be used withSetAsync() orUpdateAsync() that tells the server to increment the field's current value by the given value.

If the current value is an integer or a double, both the current and the given value will be interpreted as doubles and all arithmetic will follow IEEE 754 semantics. Otherwise, the transformation will set the field to the given value.

Details
Returns
TheFieldValue sentinel for use in a call toSetAsync() orUpdateAsync().

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

Last updated 2021-06-17 UTC.