Reputation: 1933
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?
Upvotes: 3
Views: 436
Reputation: 598688
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
Upvotes: 1