Go 使用firebase“;在;运算符导致错误
使用google Firestore数据库,我尝试使用“in”操作符查询集合 我已经从Google复制了这个示例,但是我的代码(使用golang)在“”中导致了一个错误“Firebase invalid operator”Go 使用firebase“;在;运算符导致错误,go,google-cloud-firestore,Go,Google Cloud Firestore,使用google Firestore数据库,我尝试使用“in”操作符查询集合 我已经从Google复制了这个示例,但是我的代码(使用golang)在“”中导致了一个错误“Firebase invalid operator” 这与这里的示例代码非常相似:问题在于我有一个过时的firebase库 v1.1.0版增加了对中的支持,并且数组包含任何查询运算符。实际上,我可能已经解决了这个问题。我认为go被拉进一个过时的库——将go.mod改为cloud.google.com/go/firestorev1
这与这里的示例代码非常相似:问题在于我有一个过时的firebase库
v1.1.0版增加了对
中的支持,并且数组包含任何查询运算符。实际上,我可能已经解决了这个问题。我认为go被拉进一个过时的库——将go.mod改为cloud.google.com/go/firestorev1.1.0似乎已经解决了这个问题,但我会确认是否是这样。
usernames := []string{
"5nMUe1hWCu",
"5n_8e1hwCw",
"jnM831Qwuk",
}
users := database.DB.Collection("User")
q := users.Where("Username", "in", usernames).Documents(config.CTX)
for {
doc, err := q.Next()
if err != nil {
t.Log("Throws error here:", err.Error())
}
}
// Error is -- invalid operator "in"