Why the filter doesn't work when the ancestor is not specified? Isn't it supposed to work on entity type regardless the ancestor?
My use case: I've set-up several entities with a parent key. The key corresponds with another entity (the main entity) so that I can get the children by ancestor(main entity key).
However the issue seems to be that I can't query the entity properties anymore unless I specify the ancestor. Is this the way it should work? Below is some pseudo code. I can provide working code if the issue is not clear.
type MyStruct{
Unique int
}
key1 := datastore.NewKey(c, "table1", "verylongstring", 0, nil)
kparent := datastore.NewKey(c, "table1", "anotherlongstring", 0, key1)
x := MyStruct{Unique:23}
if _, err := datastore.Put(c, kparent, &x); err != nil {
panic(err)
}
// This works
_, err := datastore.NewQuery("table1").Ascentor(kparent).Filter("Unique =", v.Unique).GetAll(cx, dst)
// Query with filter without ancestor doesn't work. Returns no results error.
_, err := datastore.NewQuery("table1").Filter("Unique =", v.Unique).GetAll(cx, dst)