I have problem. My app allows user to filter offers by few params.
I would like to fetch data with .where() operator by I need to stack them. How can I do it?
My attempt (don't work):
let query = db.collection("cards").where("cardId", "==", id);
if (filterParams.price.from && filterParams.price.to) {
query
.where("price", ">=", filterParams.price.from)
.where("price", "<=", filterParams.price.to);
}
if (filterParams.graded) {
query.where("isGraded", "==", filterParams.graded);
}
if (filterParams.condition) {
query.where("condition", "==", filterParams.condition);
}
query = await query.get();
const snapshot = await query.get()instead of assigning the result to query itself. I would also logfilterParamsto check if all values are as intended