[英]Google Could Datastore - parent entity or array property
I'm trying to get my head around NoSQL and Google Cloud Datastore, and I don't know how to chose between two different options for storing data.我正在尝试了解 NoSQL 和 Google Cloud Datastore,但我不知道如何在两种不同的数据存储选项之间进行选择。
I have a list of orders, and every order is for an unspecified number of products.我有一个订单清单,每个订单都是针对未指定数量的产品。 What are the pros/cons of storing the product list as an array property for the order entity vs having product child entities for each order parent?
将产品列表存储为订单实体的数组属性与每个订单父级都有产品子实体的优缺点是什么?
Firstly, be well aware of the distinction between the 2 possible approaches of implementing a relationship between entities:首先,要清楚实现实体之间关系的两种可能方法之间的区别:
Using the 2nd one has scalability implications, see also:使用第二个具有可扩展性影响,另见:
As for storing a list as an array property vs as separate entities, see Creating your own activity logging in GAE/P (where repeated properties is just how array properties are called in the ndb
client library context).至于将列表存储为数组属性还是单独的实体,请参阅在 GAE/P 中创建您自己的活动日志记录(其中重复的属性就是在
ndb
客户端库上下文中调用数组属性的方式)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.