简体   繁体   English

Google 可以数据存储 - 父实体或数组属性

[英]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:首先,要清楚实现实体之间关系的两种可能方法之间的区别:

  • one entity can contain a Key type property pointing to another entity (which might or might not exist!) - this is a functional relationship only, not one at the datastore level一个实体可以包含指向另一个实体的Key类型属性(可能存在也可能不存在!) - 这只是一种功能关系,而不是数据存储级别的关系
  • having the 2 datastore entities in a parent-child ( ancestry ) relationship, inside the same datastore entity group.在同一个数据存储实体组内具有父子( 祖先)关系中的 2 个数据存储实体。

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.

相关问题 实体的属性可以是 Google Cloud Datastore 中的另一个实体吗? - Can the property of an entity be another entity in Google Cloud Datastore? 子实体是否会计入Google数据存储区中父实体的总大小? - Do children entities count towards the total size of the parent entity in Google Datastore? 如何在Google Cloud数据存储区中查询复杂属性 - how to query a complex property in google cloud datastore 如何使用对象数组过滤Google数据存储区实体 - How to filter google datastore entities with object array Google数据存储区 - 每个实体组限制不会看到每秒写入1次 - Google Datastore - Not Seeing 1 Write per Second per Entity Group Limitation Google数据存储区 - Google Datastore Google数据存储区的“高度可扩展”属性究竟意味着什么? - What exactly does “Highly Scalable” property of Google datastore means? 如何通过在 Google 数据存储中传递 ID 数组作为输入来检索实体? - How to retrieve entities by passing array of IDs as input in Google datastore? Google App Engine-快速将用户记录保存到数据存储,事务,实体组 - Google App Engine - Saving User Records Quickly to Datastore, Transactions, Entity Groups Google Cloud Datastore是否真的在强制其1MB实体大小限制? - Is Google Cloud Datastore actually enforcing its 1MB entity size limit?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM