Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 05da88c

Browse files
Unable to update document using serverTimeStamp #805
1 parent 474182c commit 05da88c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/FIRESTORE.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,23 @@ citiesCollection.doc("LA").set({
155155
### `collection.doc().update()`
156156
Update any number of properties of a document.
157157

158-
Use the special property `firebase.firestore().FieldValue().serverTimestamp()` to update a server timestamp
159-
(as opposed to a local timestamp, which would be different for every client).
158+
Note that you can use the special `serverTimestamp()` function to update a server timestamp (as opposed to a local timestamp, which would be different for every client):
159+
160+
#### Web API
161+
```typescript
162+
const firebase = require("nativescript-plugin-firebase/app");
163+
164+
firebase.firestore().FieldValue().serverTimestamp()
165+
```
166+
167+
#### Native API
168+
```typescript
169+
import { firestore } from "nativescript-plugin-firebase";
170+
171+
firestore.FieldValue.serverTimestamp()
172+
```
173+
174+
And this is what an update would look like, using the Web API:
160175

161176
```typescript
162177
const sanFranciscoDocument = firebase.firestore().collection("cities").doc("SF");

0 commit comments

Comments
 (0)