DynamoDB auto incremented ID & server time (iOS SDK)

后端 未结 3 1618
既然无缘
既然无缘 2020-12-20 13:12

Is there an option in DynammoDB to store auto incremented ID as primary key in tables? I also need to store the server time in tables as the \"created at\" fields (eg., user

3条回答
  •  感情败类
    2020-12-20 13:54

    Actually, there are very few features in DynamoDB and this is precisely its main strength. Simplicity.

    • There are no way automatically generate IDs nor UUIDs.
    • There are no way to auto-generate a date

    For the "date" problem, it should be easy to generate it on the client side. May I suggest you to use the ISO 8601 date format ? It's both programmer and computer friendly.

    Most of the time, there is a better way than using automatic IDs for Items. This is often a bad habit taken from the SQL or MongoDB world. For instance, an e-mail or a login will make a perfect ID for a user. But I know there are specific cases where IDs might be useful.

    In these cases, you need to build your own system. In this SO answer and this article from DynamoDB-Mapper documentation, I explain how to do it. I hope it helps

提交回复
热议问题