firestore阵列包含无法在golang中使用的查询

时间:2019-02-21 23:50:58

标签: go google-cloud-firestore

我正在尝试查询Firestore数组,并且正在使用golang库。不幸的是,当我运行查询时,我收到“无效的运算符”数组包含”错误

不确定在运行查询时为何完全按照所示(https://github.com/GoogleCloudPlatform/golang-samples/blob/f8a3a6ed786b9fd96a5e92c2ef5fb849ec7896a9/firestore/firestore_snippets/query.go#L255

万一我的结构很重要。

rootLevel[].secondLevel[].attribute

我的代码:

    query := collection.Query
    query = query.Where("AllAccessTokens.polar.PartnerGUID", "array-contains", "aasdfasdf")
    iter := query.Documents(ctx)
    results, resultError := iter.GetAll()

我在做什么错了?

1 个答案:

答案 0 :(得分:0)

我很感激。我认为我已经知道了。有点愚蠢,但我的数组包含在一个复杂的对象上。不是字符串数组。一旦我更改了模型,便可以完美运行。谢谢!

相关问题