ple*_*iii 7 firebase google-cloud-firestore
我想过滤一个集合(让我们称之为documents
)使用array-contains
一列(比方说keywords
)并按另一列(比方说name
)排序.
我能够在firebase控制台中创建这个复合索引,但我只能猜测添加它的格式firestore.indexes.json
.
不幸的是,我们无法从控制台下载索引文件.
Jua*_*ara 19
将模式设置为ARRAY_CONTAINS:
{
"collectionId": "documents",
"fields": [
{
"fieldPath": "keywords",
"mode": "ARRAY_CONTAINS"
},
{
"fieldPath": "name",
"mode": "ASCENDING"
}
]
}
Run Code Online (Sandbox Code Playgroud)
您还可以从Firebase CLi 列出 JSON中当前的Cloud Firestore索引:
firebase firestore:indexes
Run Code Online (Sandbox Code Playgroud)
Siv*_*ywa 12
导出 Firestore 索引
firebase firestore:indexes > firestore.indexes.json
Run Code Online (Sandbox Code Playgroud)
警告!这将替换firestore.indexes.json 中的所有内容。
或者,如果您的.firebaserc 中有多个firebase项目:
"projects": {
"production": "prod-v6909",
"staging": "prod-c6020"
}
Run Code Online (Sandbox Code Playgroud)
然后你可以像这样导出:
firebase --project staging firestore:indexes > firestore.indexes.json
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
944 次 |
最近记录: |