Reputation: 863
imagine I have an array that looks like this
postedAt: 241242
categories:
- gaming: true
- history: true
- sports: true
Is it possible to create firestore index that looks something like this...
categories.* descending: true
Or do I have to create an index for every possible value inside categories?
Thanks a lot for the help.
Upvotes: 0
Views: 98
Reputation: 2216
Yes. Use Subcollections.
let data: [String: Any] = [
"postedAt": 241242,
"categories": [
"gaming": true,
"history": true,
"sports": true,
]
]
Firestore.firestore().collection("users/data").addDocument(data)
Upvotes: 1