Firestore API - Class FieldValue (3.5.1)

public static class FieldValue

Reference documentation and code samples for the Firestore API class FieldValue.

A static class providing properties and methods to represent sentinel values. Sentinel values are special values where the client-side value is not part of the document modification sent to the server. A property decorated with FirestorePropertyAttribute 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.

Inheritance

object > FieldValue

Namespace

Google.Cloud.Firestore

Assembly

Google.Cloud.Firestore.dll

Properties

Delete

public static object Delete { get; }

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

Property Value
TypeDescription
object

ServerTimestamp

public static object ServerTimestamp { get; }

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

Property Value
TypeDescription
object

Methods

ArrayRemove(FirestoreDb, params object[])

public static object ArrayRemove(FirestoreDb database, params object[] values)

Creates a sentinel value to indicate the removal of the given values with an array. This over

Parameters
NameDescription
databaseFirestoreDb

Database to check for custom serialization.

valuesobject

The values to include in the resulting sentinel value. Must not be null.

Returns
TypeDescription
object

A sentinel value representing an array removal.

ArrayRemove(params object[])

public static object ArrayRemove(params object[] values)

Creates a sentinel value to indicate the removal of the given values with an array. This overload assumes that any custom serializers are configured via attributes. Use the overload accepting a FirestoreDb if you need to use database-registered custom serializers.

Parameter
NameDescription
valuesobject

The values to include in the resulting sentinel value. Must not be null.

Returns
TypeDescription
object

A sentinel value representing an array removal.

ArrayUnion(FirestoreDb, params object[])

public static object ArrayUnion(FirestoreDb database, params object[] values)

Creates a sentinel value to indicate the union of the given values with an array.

Parameters
NameDescription
databaseFirestoreDb

Database to check for custom serialization.

valuesobject

The values to include in the resulting sentinel value. Must not be null.

Returns
TypeDescription
object

A sentinel value representing an array union.

ArrayUnion(params object[])

public static object ArrayUnion(params object[] values)

Creates a sentinel value to indicate the union of the given values with an array. This overload assumes that any custom serializers are configured via attributes. Use the overload accepting a FirestoreDb if you need to use database-registered custom serializers.

Parameter
NameDescription
valuesobject

The values to include in the resulting sentinel value. Must not be null.

Returns
TypeDescription
object

A sentinel value representing an array union.

Increment(double)

public static object Increment(double amount)

Creates a sentinel value to indicate an increment by the given value.

Parameter
NameDescription
amountdouble

The amount to increment the field by.

Returns
TypeDescription
object

A sentinel value representing a field increment.

Remarks

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.

Increment(long)

public static object Increment(long amount)

Creates a sentinel value to indicate an increment by the given value.

Parameter
NameDescription
amountlong

The amount to increment the field by.

Returns
TypeDescription
object

A sentinel value representing a field increment.

Remarks

If the current field value is an integer, possible integer overflows are resolved to MaxValue or MinValue. 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.