From c660f300fc36f4298727b97c2edc190945558eda Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Tue, 16 Apr 2019 10:00:58 -0700 Subject: [PATCH] docs: Add example for Precondition --- dev/src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dev/src/index.ts b/dev/src/index.ts index c869df928..ff21854f3 100644 --- a/dev/src/index.ts +++ b/dev/src/index.ts @@ -133,6 +133,16 @@ const GRPC_UNAVAILABLE = 14; * can be restricted to only apply to documents that match the specified * conditions. * + * @example + * const documentRef = firestore.doc('coll/doc'); + * + * documentRef.get().then(snapshot => { + * const updateTime = snapshot.updateTime; + * + * console.log(`Deleting document at update time: ${updateTime.toDate()}`); + * return documentRef.delete({ lastUpdateTime: updateTime }); + * }); + * * @property {string} lastUpdateTime The update time to enforce (specified as * an ISO 8601 string). * @typedef {Object} Precondition