FieldValue

public abstract class FieldValue extends Object

Sentinel values that can be used when writing document fields with set() or update().

Public Method Summary

static FieldValue
arrayRemove(Object... elements)
Returns a special value that can be used with set() or update() that tells the server to remove the given elements from any array value that already exists on the server.
static FieldValue
arrayUnion(Object... elements)
Returns a special value that can be used with set() or update() that tells the server to union the given elements with any array value that already exists on the server.
static FieldValue
delete()
Returns a sentinel for use with update() to mark a field for deletion.
static FieldValue
serverTimestamp()
Returns a sentinel for use with set() or update() to include a server-generated timestamp in the written data.

Inherited Method Summary

Public Methods

public static FieldValue arrayRemove (Object... elements)

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

Parameters
elements The elements to remove from the array.
Returns
  • The FieldValue sentinel for use in a call to set() or update().

public static FieldValue arrayUnion (Object... elements)

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

Parameters
elements The elements to union into the array.
Returns
  • The FieldValue sentinel for use in a call to set() or update().

public static FieldValue delete ()

Returns a sentinel for use with update() to mark a field for deletion.

public static FieldValue serverTimestamp ()

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

Send feedback about...

Need help? Visit our support page.