【发布时间】:2019-09-25 03:03:17
【问题描述】:
我正在尝试使用 add() 方法将文档添加到 Firestore。根据文档add() 方法为每个文档生成一个唯一的 ID 并以任意随机顺序存储它并以有序方式存储它,我们需要在文档中的 timestamp 字段中存储它。以下是我的做法:
def add_data(message):
message.update({u'timestamp': firestore.SERVER_TIMESTAMP})
coll_ref.add(message)
当我执行上述方法时出现错误:
TypeError: ('Cannot convert to a Firestore Value', <object object at 0x104fdebe0>, 'Invalid type', <class 'object'>)
为什么会出现此错误? firestore Python SDK 中是否存在错误,如果有,那么是否已针对此问题发布任何补丁?
【问题讨论】:
标签: python firebase google-cloud-firestore firebase-admin