Firestore 持续时间类型

Firestore duration type

似乎可以编写 check that a value is of the duration type 的 Firestore 规则,如下所示:

allow write: if request.resource.data.bla is duration;

但是,完全神秘如何生成这样的值,至少从 Web API 是这样。

Firestore 规则参考有一个部分用于 duration namespace and the Duration interface

在这个official Firebase video中甚至提到了(link指出了正在谈论持续时间类型的确切时间)。

我在 Rules Playground 中成功测试编写了一个文档,该文档的值设置为 <number>s 模式,例如100s5s 甚至 0.5s,所以我认为这会映射到一定的秒数。我尝试了其他一些单位,例如1w(1 周)或 3d(3 天)或 5m(5 分钟),但没有成功。
此外,其中 none 个可以在 Firestore 模拟器中本地运行。

我知道持续时间类型对于验证例如时间戳输入,但我不希望它按原样被单独接受(因此没有理由 is duration 编译)。
我错过了什么吗?这种类型是隐藏的、未使用的还是...?

来自documentation,

Valid data types for the is operator are bool, bytes, float, int, list, latlng, number, path, map, string, and timestamp. The is operator also supports constraint, duration, set, and map_diff data types, but since these are generated by the security rules language itself and not generated by clients, you rarely use them in most practical applications.

因此 is duration 主要可用于验证安全规则中任何操作的结果(主要是与时间戳相关的计算)是否为持续时间类型。

您分享的视频解释了哪些表情 return 时长:

Expression Result
timestamp ± duration timestamp
timestamp - timestamp duration
duration ± duration duration