简体   繁体   中英

Update Server time stamp - firestore

I am new to using firestore and would greatly appreciate an answer.

I am updating the documents in my firestore with a timestamp. Will that timestamp represent the time that document was originally created, or does the timestamp represent the time that i updated it?

It just depends on whether you update that field in particular or not.

If you update the field containing the timestamp on each write then it will represent that update time. You don't mention it but if you work with AngularFire, you can make sure the timestamp gets updated on each write if your update is something like this:

.doc('user/' + user.id).update({
      someValue: "someValue",
      date: firebase.default.firestore.FieldValue.serverTimestamp()
    })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM