3
votes

I'm building a real time chat application in firestore and I'm currently having a problem reading back message timestamps. I'm using an onSnapshot listener to get updates from my messages collection, however I'm finding that I'm getting an undefined error on the latest timestamp which leads to me to think that the serverTimestamp() is an asynchronous method on the server side. I cant find any documentation regarding this

Is this the case?

1

1 Answers

4
votes

serverTimestamp() just returns a static sentinel value on the client. It can't possibly generate an error. All this sentinel value does is tell the server to use its sense of current time to populate the field where it appears.