我有以下情况:
type Band struct {
Name string
LocationId *datastore.Key
Albums []Album
}
type Album struct {
Name string
GenreId *datastore.Key
Year int
}
我想要查询Band
的{{1}}密钥,查找具有特定Albums
密钥的相册。
答案 0 :(得分:4)
我找到了答案。事实证明这很简单。而不是
Filter("GenreId =", genreId)
我用过
Filter("Albums.GenreId =", genreId)
这给了我有效的查询结果。