Class FieldValue (2.4.0)

public static 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, 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(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, 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(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(Int64)

public static object Increment(long amount)

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

Parameter
NameDescription
amountInt64

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.