gpt4 book ai didi

firebase.firestore.FieldValue.serverTimestamp() concat with string val(带字符串值的firebase.firestore.FieldValue.serverTimestamp()合并)

转载 作者:bug小助手 更新时间:2023-10-28 11:36:05 34 4
gpt4 key购买 nike



As per Firebase documentation, we should not use incremental values as it may cause hotspots.
I have multiple subcollections and I am only interested in ordering my subcollection, so I want to concat server-side timestamp with a document ID (which represents the document inside which my subcollection exist)

根据Firebase文档,我们不应该使用增量值,因为它可能会导致热点。我有多个子集合,并且我只对对子集合进行排序感兴趣,所以我希望将服务器端时间戳与文档ID(它表示我的子集合所在的文档)连接在一起


But as the serverside time stamp is calculated at the server level, how can I do it?

但是,由于服务器端时间戳是在服务器级别计算的,我该如何做呢?


更多回答

You can't - if you must use a server timestamp, you can only write that value to a field by itself using the server timestamp token in your code.

不能--如果必须使用服务器时间戳,则只能在代码中使用服务器时间戳标记将该值单独写入字段。

优秀答案推荐



I am having multiple subcollections and I am only interested in ordering my subcollections.



You cannot order subcollections. According to the docs, the ordering refers to documents and not to collections or subcollections.

不能对子集合进行排序。根据文件,排序是指单据,而不是集合或子集合。



I want to concat server-side timestamp with a document ID.



You can choose to name the subcollections any way you want, but you won't find a function that will order them.

您可以选择以任何您想要的方式来命名这些子集,但是您将找不到对它们进行排序的函数。



But as the serverside timestamp is calculated at the server level, how can I do it?



As @DougStevenson mentioned in his comment, if you need to use a server timestamp, then you have to write that value to a field (of the document) using the server timestamp token in your application's code.

正如@DougStevenson在他的评论中提到的,如果需要使用服务器时间戳,则必须使用应用程序代码中的服务器时间戳令牌将该值写入(文档的)字段。


更多回答

Hey there. Did my answer help? Can I help you with other information?

嘿你好啊。我的回答有帮助吗?我能为您提供其他信息吗?

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com