Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

96
Vistas
How to add query operators to query of Firestore?

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();
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Query objects are immutable. Each time you call where it returns a new Query object, which you need to then keep a reference to that query.

So:

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda