I am doing a document filter functionality.
The problem is that when I receive a filter for the "max_players" and "name" fields, it returns an empty array when there are documents that meet the conditions.
The error occurs when doing startAt and endAt when there is more than one OrderBy and I don't understand the reason.
Technologies:
Service:
if (filter.players != null) {
const option: string = filter.players.substring(0, 1);
if (option == '+') {
ref = ref.where('max_players', '>=', 8)
} else {
const num_players: number = parseInt(option);
ref = ref.where('max_players', '>=', num_players)
}
}
if (filter.text != null) {
if (filter.players != null) {
ref = ref.orderBy('max_players').orderBy('name').startAt(filter.text).endAt(filter.text + '\uf8ff');
}else{
ref = ref.orderBy('name').startAt(filter.text).endAt(filter.text + '\uf8ff');
}
}
Firebase limitation
Documentation: https://github.com/firebase/firebase-js-sdk/issues/2577#