Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 索引存储多个值_Ios_Swift_Google Cloud Firestore - Fatal编程技术网

Ios 索引存储多个值

Ios 索引存储多个值,ios,swift,google-cloud-firestore,Ios,Swift,Google Cloud Firestore,假设我有一个如下所示的数组 postedAt: 241242 categories: - gaming: true - history: true - sports: true 是否可以创建看起来像这样的firestore索引 类别。*降序:true 或者我必须为类别中的每个可能值创建索引吗 非常感谢您的帮助。是的 let data: [String: Any] = [ "postedAt": 241242, "categories": [ "gaming":

假设我有一个如下所示的数组

postedAt: 241242
categories:
- gaming: true
- history: true
- sports: true
是否可以创建看起来像这样的firestore索引

类别。*降序:true

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

非常感谢您的帮助。

是的

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

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