In Firestore, how can you do a compound query involving a key in a map without creating an index for every key?
For example, consider a collection which holds blog posts
This is doable by setting the value of each category to what you want to sort on. Firestore has a guide that covers this.
Post {
title: ..
...
categories: {
cats: createdAt
puppies: createdAt
}
}
let query = db.collection(`/posts`)
.where(`categories.${categoryId}`, '>', 0)
.orderBy(`categories.${categoryId}`)
.startAfter(lastDate)
.limit(5);