What should we use in indexes.json file for arrays query?
"collectionGroup": "posts",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "category",
"order": "ASCENDING"
},
{
"fieldPath": "tags",
"order": "***ARRAY?***"
},
You want "arrayConfig": "CONTAINS"
.
"collectionGroup": "posts",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "category",
"order": "ASCENDING"
},
{
"fieldPath": "tags",
"arrayConfig": "CONTAINS"
},
In the future, you can actually figure this out for yourself by running firebase init firestore
in a new folder, and it will create the indexes file based on what you created in the console. Also in the future, the JSON will be documented.