gpt4 book ai didi

firebase - Firebase 键对于整个数据库来说是唯一的吗?

转载 作者:行者123 更新时间:2023-12-02 19:11:53 26 4
gpt4 key购买 nike

使用 push() 时,Firebase 会创建一个唯一 ID 或 key ,例如 -KKm9iRSax-scGn7m3Lb

根据文档:

The push() method generates a unique ID every time a new child is added to the specified Firebase reference.

还有:

The unique ID generated by push() is based on a timestamp, so list items are automatically ordered chronologically.

此 ID 或 key 对整个数据库来说是唯一的,还是仅对引用而言是唯一的(例如 /users)?

最佳答案

Firebase 键部分是时间戳,部分是随机字符。因此,虽然它们在整个数据库中应该是唯一的,但两个键最终相同的可能性很小。

Firebase blog: The 2^120 Ways to Ensure Unique Identifiers

关于firebase - Firebase 键对于整个数据库来说是唯一的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38207466/

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