删除祖先后,子数据存储对象会发生什么? [英] What happens to child datastore objects after deleting the ancestor?
问题描述
我想了解在线文档中没有提到的Google AppEngine数据存储中找到的父/子(祖先路径)关系。父母被删除时儿童对象会发生什么?孩子的对象还会被删除吗?没有父母成孤儿吗?如果是这样,你会如何查询他们?
I want to understand the parent/child (ancestor paths) relationship found in the Google AppEngine datastore that wasn't mentioned in the online documentation. What happens to children objects when the parent is deleted? Do child objects also get deleted? Do they become orphaned without a parent? If so how would you query for them?
Google帮助文档有关祖先路径: https://cloud.google.com/appengine/docs/go/datastore/entities#Go_Ancestor_paths
Google Help Doc regarding Ancestor Paths: https://cloud.google.com/appengine/docs/go/datastore/entities#Go_Ancestor_paths
谢谢!
〜Todd
Thanks! ~Todd
推荐答案
删除祖先时,子实体不会被删除:没有删除级联行为。实际上,当定义一个实体组(只有它的Key)时,一个祖先实体甚至不需要存在。
Child entities do not get deleted when the ancestor is deleted: there's no 'cascade on delete' behaviour. In fact, an ancestor entity doesn't even have to exist when defining an entity group (only its Key).
这篇关于删除祖先后,子数据存储对象会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!