If I’m doing a
Collection.insert({"name":"Record 1",creationTime:new Date()});
from the client, because the command is going to be sent to the server anyway, is there a way to use the server’s time instead of the client’s time at the point of data insertion?
Using new Date(); may be inconsistent because the client’s time could be anything.
I’m aware we could fetch the server’s time before inserting the query, but it does seem a bit redundant considering the insertion command is going to be sent back to the server.
You could simply do this to avoid the already-sending-to-server-redundancy:
Or from the client: