I'm trying to write the now timestamp using the rest api of firestore. The sending application doesn't keep the time so its up to the server to store the value.
{
"fields": {
"Type": {
"stringValue": "temperature"
},
"Timestamp": {
"timestampValue": "2019-02-18T23:00:00Z"
},
"Value": {
"integerValue": "17"
}
}
}
The values get stored properly but I want to be able to change the static 2019-02-18T23:00:00Z to the now value.
How can this be done?
To write the server-side timestamp in a field, you need to use a FieldTransform for that. See Firestore REST API add Timestamp and https://cloud.google.com/firestore/docs/reference/rest/v1/Write
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With