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

95
Views
¿Cómo agregar operadores de consulta a la consulta de Firestore?

Tengo un problema. Mi aplicación permite al usuario filtrar ofertas por algunos parámetros. Me gustaría obtener datos con el operador .where() cuando necesito apilarlos. ¿Cómo puedo hacerlo?

Mi intento (no funciona):

 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();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Los objetos de consulta son inmutables. Cada vez que llama a where devuelve un nuevo objeto de Query , que debe mantener una referencia a esa consulta.

Asi que:

 let query = db.collection("cards").where("cardId", "==", id); if (filterParams.price.from && filterParams.price.to) { query = query // 👈 .where("price", ">=", filterParams.price.from) .where("price", "<=", filterParams.price.to); } if (filterParams.graded) { query = query.where("isGraded", "==", filterParams.graded); // 👈 } if (filterParams.condition) { query = query.where("condition", "==", filterParams.condition); // 👈 } query = await query.get();
about 4 years ago · Juan Pablo Isaza Report
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!