1

I have not run into this particular error before, and when I Google it I can't find anything at all out there that even mentions it. I am using Go language, performing a standard datastore query like I have many times before using an iterator, and I get this error: "proto: required fields not set in datastore.QueryResult". See my code below, any ideas?

k, err := datastore.NewQuery("QBConnection").
    Ancestor(datastore.NewKey(c, "Company", "", x.CompanyID, nil)).
    Limit(1).
    Run(c).
    Next(x)
if err != nil {
    if _, ok := err.(*datastore.ErrFieldMismatch); ok { err = nil } //ignore it if we can't load some fields
    if err == datastore.Done { err = nil } //If we don't find it in datastore, then just return nil
    if err != nil {return err}
}
4

1 回答 1

3

至少,我为我的情况弄清楚了。我仍然不确定错误消息的确切含义,当我在实时环境中运行它时遇到了另一个错误(这导致了我的答案)。在实时站点上,它告诉我“祖先缺少 id/name”... 长话短说,我的 x.CompanyID 变量在运行查询之前没有正确设置。不知道为什么错误消息在 dev/live 上如此不同,并且肯定会有助于在我的开发服务器上获取缺少的 id/name 错误......但是哦,好吧,问题解决了。

于 2013-06-03T16:41:31.017 回答