I'm trying to apply some search filters for an application i'm developing that uses firestore and react. My problem is that when I want to filter the results I may use only 2 of the 4 fields I'm working with, and that gives an error, a different one depending on which way I get to the usecase.
My filter form is formed by 4 fields, type, subtype, calification, and name. for now im using just this kind of filter:
//This would be a query with one filter applied
getDocs(query(collection(db, "datosTest"),where("clasification", "==", clasificationMin)))
//If the user doesn't apply filters this is the query I want the program to make
getDocs(query(collection(db, "datosTest")))
I want to, if possible be able to add it to the query if it's different from null (or "" for that matter) and not having it append to the query if it is, in fact, empty.
Thanks in advance for your time