Reputation: 860
Using google Firestore database, I am trying to query a collection using the 'in' operator.
I have closely copied the example from Google, but my code (using golang) results in an error "Firebase invalid operator "in" ".
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"
This closely follows the example code here: https://firebase.google.com/docs/firestore/query-data/queries#array_membership
Upvotes: 0
Views: 554
Reputation: 860
The problem was that I had an out of date firebase library.
Version v1.1.0 adds support for in
and array-contains-any
query operators.
Upvotes: 1