删除祖先后 child 数据存储区 objects 会发生什么情况?
What happens to child datastore objects after deleting the ancestor?
我想了解在 Google AppEngine 数据存储区中找到的 parent/child(祖先路径)关系,在线文档中没有提及。当 parent 被删除时 children objects 会发生什么? child objects 也会被删除吗?如果没有 parent,他们会成为孤儿吗?如果是这样,您将如何查询它们?
Google 有关祖先路径的帮助文档:https://cloud.google.com/appengine/docs/go/datastore/entities#Go_Ancestor_paths
谢谢!
~托德
删除祖先时不会删除子实体:没有 'cascade on delete' 行为。事实上,在定义实体组时甚至不必存在祖先实体(仅存在其 Key)。
它们不会受到影响,只是您无法获取它们的父实体。即
child_entity.key.parent().get()
将 return None。
我想了解在 Google AppEngine 数据存储区中找到的 parent/child(祖先路径)关系,在线文档中没有提及。当 parent 被删除时 children objects 会发生什么? child objects 也会被删除吗?如果没有 parent,他们会成为孤儿吗?如果是这样,您将如何查询它们?
Google 有关祖先路径的帮助文档:https://cloud.google.com/appengine/docs/go/datastore/entities#Go_Ancestor_paths
谢谢! ~托德
删除祖先时不会删除子实体:没有 'cascade on delete' 行为。事实上,在定义实体组时甚至不必存在祖先实体(仅存在其 Key)。
它们不会受到影响,只是您无法获取它们的父实体。即
child_entity.key.parent().get()
将 return None。