Constructor

FieldValue

new FieldValue()

Methods

delete

static

delete() returns any type

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

Returns

any type 

The sentinel value to use in your objects.

Example

let documentRef = firestore.doc('col/doc');
let data = { a: 'b', c: 'd' };

documentRef.set(data).then(() => {
  return documentRef.update({a: Firestore.FieldValue.delete()});
}).then(() => {
  // Document now only contains { c: 'd' }
});

serverTimestamp

static

serverTimestamp() returns any type

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

Returns

any type 

The sentinel value to use in your objects.

Example

let documentRef = firestore.doc('col/doc');

documentRef.set({
  time: Firestore.FieldValue.serverTimestamp()
}).then(() => {
  return documentRef.get();
}).then(doc => {
  console.log(`Server time set to ${doc.get('time')}`);
});