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

111
Views
orderBy y cláusula where no funcionan juntas en firestore

Estoy usando una cláusula where en mi consulta de firestore para filtrar según un type de atributo y luego ordenarlos usando orderBy para ordenarlos por time .

 const tradesRef = firebase .firestore() .collection("cex-trades") .orderBy("time", "desc") .limit(16); useEffect(() => { if (filter === "5m") { tradesRef .where("type", "==", "fifteenMinutes") .get() .then((collections) => { const tradesData = collections.docs.map((trade) => trade.data()); const lastDoc = collections.docs[collections.docs.length - 1]; const firstDoc = collections.docs[collections.docs.length - 16]; setTrades(tradesData); setFirstTrade(firstDoc); setLastTrades(lastDoc); }) .catch((error) => { console.error(error); }); } }, [filter]);

Cuando ejecuto mi código, recibo este error:

FirebaseError: la consulta requiere un índice. You can create it here: https://console.firebase.google.com/v1/r/project/whaletracer-432e8/firestore/indexes?create_composite=ClRwcm9qZWN0cy93aGFsZXRyYWNlci00MzJlOC9kYXRhYmFzZXMvKGRlZmF1bHQpL2NvbGxlY3Rpb25Hcm91cHMvY2V4LXRyYWRlcy9pbmRleGVzL18QARoICgR0eXBlEAEaCAoEdGltZRACGgwKCF9fbmFtZV9fEAI

Seguí el enlace y creé un índice de la siguiente manera: índice actualizado

Después de crear el índice, sigo recibiendo el mismo error. ¿Alguna idea de cómo resolver el problema?

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!