python - How to add timestamp to my document in cloud Firestore using Firebase Python Admin SDK?
问题描述
I'm trying to add a timestamp value, along with other details to a comment document in Cloud Firestore. I would like to know how can I do it using Firebase Admin Python SDK. As far as I know to get server time stamp, in JS SDK you use
admin.firestore().Field value.serverTimestamp()
Is there any Python SDK equivalent of this?
解决方案
From the documentation:
To set a field to the current time on the server when the update is received, use the SERVER_TIMESTAMP sentinel.
>>> field_updates = {
... 'foo.now': firestore.SERVER_TIMESTAMP,
... }
>>> document.update(field_updates)
推荐阅读
- php - SPL InfiniteIterator is not working with next or prev
- gradle - how to apply double dollar ( $$) for a string variable in gradle
- firebase - Firebase 科尔多瓦登录设置
- reactivesearch - Customized Reactive Component interact with SelectedFilters
- ssis - Unable to generate BIML script for Tiering in SSIS
- terraform - terraform var output to pick from a map element in list of maps
- php - How to detect social media giants Bots and refine the useragent in php?
- ios - Sharing CocoaPod using UIApplication.shared between iOS Extension and app
- excel - 在单元格中查找“USA”并返回下一个 6 个数字
- javascript - Upload a base 64 image on post call to firebase storage by cloud function in typescript