For example, take the following snippet from the provided appengine-angular-gotodos :
func getAllTodos(c appengine.Context) ([]Todo, error) {
todos := []Todo{}
ks, err := datastore.NewQuery("Todo").Ancestor(defaultTodoList(c)).Order("Created").GetAll(c, &todos)
if err != nil {
return nil, err
}
for i := 0; i < len(todos); i++ {
todos[i].Id = ks[i].IntID()
}
return todos, nil
}
If you change the query to not include .Ancestor(defaultTodoList(c)).
the function fails to return any todo results.
- If an entity is saved with an ancestry, must you query it by that ancestor?
- How do you query for Entities regardless of whether they are children, or root entities?
- What are the performance and architecture considerations I should make when modeling my app given the need to do ancestor-less queries?