I need to create many firestore queries with using soooo many where clause in a few services, here is example code:
let user = await db.collection('user');
if (firstName) {
user = user.where("name", "==", firstname);
}
if (lastName) {
user = user.where("lastName", "==", lastName);
}
//many many more where clause
return user.get();
I need to create something like this in a many places in my project, so now I have a question, Is there any possibility to create an one generic method to search in Firestore collections with using many where clause?
thanks for any help, i want to omit boilerplate in my project