Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
How to apply filters depending on if they're empty or not on firestore + javascript

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!