索引Firestore多个值

时间:2018-03-24 23:27:04

标签: ios swift google-cloud-firestore

想象我有一个看起来像这样的数组

postedAt: 241242
categories:
- gaming: true
- history: true
- sports: true

是否可以创建看起来像这样的火焰存储索引......

类别。*降序:真实

或者我是否必须为类别中的每个可能值创建索引?

非常感谢你的帮助。

1 个答案:

答案 0 :(得分:1)

是。 Use Subcollections

let data: [String: Any] = [
    "postedAt": 241242,
    "categories": [
        "gaming": true,
        "history": true,
        "sports": true,
    ]
]

Firestore.firestore().collection("users/data").addDocument(data)