Firebase: how to generate a unique numeric ID for key?

后端 未结 5 1655
耶瑟儿~
耶瑟儿~ 2020-12-02 13:09

I need numeric IDs for human readability. How do I get it in Firebase?

I want numeric ID for keys, e.g. \"000000001\", \"000000002\",\"00000003\",\"00000004\".

5条回答
  •  暖寄归人
    2020-12-02 13:23

    https://firebase.google.com/docs/firestore/manage-data/transactions

    Use transactions and keep a number in the database somewhere that you can increase by one. This way you can get a nice numeric and simple id.

提交回复
热议问题