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.
Namespace: Google.Cloud.Firestore
Assembly: Google.Cloud.Firestore.dll
Syntax
public static class FieldValue
Properties
Delete
Sentinel value indicating that the field should be deleted from the document.
Declaration
public static object Delete { get; }
Property Value
Type | Description |
---|---|
object |
ServerTimestamp
Sentinel value indicating that the field should be set to the timestamp of the commit that creates or modifies the document.
Declaration
public static object ServerTimestamp { get; }
Property Value
Type | Description |
---|---|
object |
Methods
ArrayRemove(FirestoreDb, params object[])
Creates a sentinel value to indicate the removal of the given values with an array. This over
Declaration
public static object ArrayRemove(FirestoreDb database, params object[] values)
Parameters
Type | Name | Description |
---|---|---|
FirestoreDb | database | Database to check for custom serialization. |
object[] | values | The values to include in the resulting sentinel value. Must not be null. |
Returns
Type | Description |
---|---|
object | A sentinel value representing an array removal. |
ArrayRemove(params object[])
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.
Declaration
public static object ArrayRemove(params object[] values)
Parameters
Type | Name | Description |
---|---|---|
object[] | values | The values to include in the resulting sentinel value. Must not be null. |
Returns
Type | Description |
---|---|
object | A sentinel value representing an array removal. |
ArrayUnion(FirestoreDb, params object[])
Creates a sentinel value to indicate the union of the given values with an array.
Declaration
public static object ArrayUnion(FirestoreDb database, params object[] values)
Parameters
Type | Name | Description |
---|---|---|
FirestoreDb | database | Database to check for custom serialization. |
object[] | values | The values to include in the resulting sentinel value. Must not be null. |
Returns
Type | Description |
---|---|
object | A sentinel value representing an array union. |
ArrayUnion(params object[])
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.
Declaration
public static object ArrayUnion(params object[] values)
Parameters
Type | Name | Description |
---|---|---|
object[] | values | The values to include in the resulting sentinel value. Must not be null. |
Returns
Type | Description |
---|---|
object | A sentinel value representing an array union. |
Increment(double)
Creates a sentinel value to indicate an increment by the given value.
Declaration
public static object Increment(double amount)
Parameters
Type | Name | Description |
---|---|---|
double | amount | The amount to increment the field by. |
Returns
Type | Description |
---|---|
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)
Creates a sentinel value to indicate an increment by the given value.
Declaration
public static object Increment(long amount)
Parameters
Type | Name | Description |
---|---|---|
long | amount | The amount to increment the field by. |
Returns
Type | Description |
---|---|
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.