Google cloud datastore only store unique entity

前端 未结 3 1904
伪装坚强ぢ
伪装坚强ぢ 2021-01-20 04:29

I am trying to learn NoSQL with Google Datastore but I am running into a problem with uniqueness.

Consider an ecommerce store, it has categories and products.

<
3条回答
  •  有刺的猬
    2021-01-20 04:52

    You can use "sku" as an "id" (if it's a number) or "name" (if it's a string) for your entity, instead of storing "sku" as a property. Then it's guaranteed to be unique as it becomes part of the unique entity key.

提交回复
热议问题