Python 3.x 如何在数组中存储firestore.SERVER\u时间戳

Python 3.x 如何在数组中存储firestore.SERVER\u时间戳,python-3.x,firebase,google-cloud-firestore,Python 3.x,Firebase,Google Cloud Firestore,我想在firestore中归档并更新一个包含许多firestore.SERVER\u时间戳的数组,但当我获取此文档并执行此操作时 accesses.update({ u"mylist": [firestore.SERVER_TIMESTAMP]}) 它抛出 TypeError: ('Cannot convert to a Firestore Value', Sentinel: Value used to set a document field to the server timestamp.

我想在firestore中归档并更新一个包含许多
firestore.SERVER\u时间戳
的数组,但当我获取此文档并执行此操作时

accesses.update({ u"mylist": [firestore.SERVER_TIMESTAMP]})
它抛出

TypeError: ('Cannot convert to a Firestore Value', Sentinel: Value used to set a document field to the server timestamp., 'Invalid type', <class 'google.cloud.firestore_v1.transforms.Sentinel'>) 
TypeError:(“无法转换为Firestore值”,Sentinel:用于将文档字段设置为服务器时间戳的值,'Invalid type',)
那么,有可能做到这一点吗?怎样做?

是一个类似的问题

显示如下代码:

import firebase_admin
from firebase_admin import firestore

# I have GOOGLE_APPLICATION_CREDENTIALS configured.
firebase_admin.initialize_app()
client = firestore.client()
result = client.collection('test').document('foo').set({
    'mytime':firestore.SERVER_TIMESTAMP
})
print(result)
这张照片打印出来:

update_time {
  seconds: 1523491166
  nanos: 932097000
}
值按预期存储在数据库中。

是一个类似的问题

显示如下代码:

import firebase_admin
from firebase_admin import firestore

# I have GOOGLE_APPLICATION_CREDENTIALS configured.
firebase_admin.initialize_app()
client = firestore.client()
result = client.collection('test').document('foo').set({
    'mytime':firestore.SERVER_TIMESTAMP
})
print(result)
这张照片打印出来:

update_time {
  seconds: 1523491166
  nanos: 932097000
}

值按预期存储在数据库中。

是的,它可以工作。但我说了另一件事。我想存储firestore.SERVER\u时间戳数组,它只存储单个值。您是否尝试过使用
ArrrayUnion
?应该是这样的:
access.update({u“mylist”:firestore.ArrayUnion([firestore.SERVER\u TIMESTAMP]))
是的,它可以工作。但我说了另一件事。我想存储firestore.SERVER\u时间戳数组,它只存储单个值。您是否尝试过使用
ArrrayUnion
?应该是这样的:
access.update({u“mylist”:firestore.ArrayUnion([firestore.SERVER\u TIMESTAMP]))