Firebase push uniqueness scope

后端 未结 2 1794
醉话见心
醉话见心 2021-01-14 19:25

The docs say Firebase push generates a unique key, I want to know if this key is unique across my whole database (or even a GuId), or just in the node where it was pushed on

2条回答
  •  死守一世寂寞
    2021-01-14 20:22

    It is unique across the whole database. From the documentation:

    Generate a new child location using a unique name and returns a Firebase reference to it. This is useful when the children of a database location represent a collection of items. See Saving Lists of Data.

    You can optionally pass a value to push() and the value will be immediately written to the generated location. If you don't pass a value to push(), nothing is written and the child will remain empty unless written to using set().

    The unique name generated by push() is prefixed with a client-generated timestamp so that the resulting list will be chronologically-sorted.

提交回复
热议问题