Can an entity have multiple parents that don't go in a single line like son->father->grandfather?
Examples:
Family tree: Mom & Dad are both parents of all their children.
No, an entity can only have a single parent. From Ancestor paths:
Entities in Cloud Datastore form a hierarchically structured space similar to the directory structure of a file system. When you create an entity, you can optionally designate another entity as its parent; the new entity is a child of the parent entity (note that unlike in a file system, the parent entity need not actually exist). An entity without a parent is a root entity. The association between an entity and its parent is permanent, and cannot be changed once the entity is created. Cloud Datastore will never assign the same numeric ID to two entities with the same parent, or to two root entities (those without a parent).
An entity's parent, parent's parent, and so on recursively, are its ancestors; its children, children's children, and so on, are its descendants. The sequence of entities beginning with a root entity and proceeding from parent to child, leading to a given entity, constitute that entity's ancestor path. The complete key identifying the entity consists of a sequence of kind-identifier pairs specifying its ancestor path and terminating with those of the entity itself:
[User:alice, TaskList:default, Task:sampleTask]For a root entity, the ancestor path is empty and the key consists solely of the entity's own kind and identifier:
[User:alice]
Following the directory structure comparison: a file can only exist in one directory, not in two or more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With