【发布时间】:2012-05-17 06:29:46
【问题描述】:
我在父子关系中创建了实体:
# Create Employee entity
employee = Employee()
employee.put()
# Set Employee as Address entity's parent directly...
address = Address(parent=employee)
# ...or using its key
e_key = employee.key()
address = Address(parent=e_key)
# Save Address entity to datastore
address.put()
那么,假设我们只知道地址实体,想要获取父(员工)。 我们可以得到地址'父:
address.key().parent()
但是,当我只知道员工时,我不知道如何获取员工的孩子。我发现 Key.from_path(...) 方法是从父子关系中获取 Key 的,但我不知道如何处理。
【问题讨论】:
-
目前我认为不可能从父母那里查询孩子。
-
我确实在你的问题中看到了 Python,如果你可以实现类似的东西,我仍然将此链接粘贴到 Java 中的类似内容:stackoverflow.com/questions/528650/…