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

178
Views
La función forEach () no se activa en la consulta de Google Cloud Firestore

Estoy trabajando en la creación de una base de datos de Firestore alojada a través de una aplicación web. Quiero consultar todos los documentos en mi colección de "tareas" y agarrar los que no están etiquetados como extra y que tienen el valor de campo "depto" de "MUSH".

Aquí hay un extracto de mi código:

 import { initializeApp } from "firebase/app"; import { getFirestore, collection, getDocs, query, where } from 'firebase/firestore'; const app = initializeApp(firebaseConfig); const db = getFirestore(app); const mush = query(collection(db, "tasks"), where("extra", "!=", "true"), where("dept", "==", "MUSH")); const mushList = []; const innerMushList = []; const weekdayList = [] try { const mushSnapshot = await getDocs(mush); console.log("checkpoint 1"); mushSnapshot.forEach((doc) => { console.log("checkpoint 2"); const task = doc.get("task"); innerMushList.push(task); if (doc.get("monday") != null) { weekdayList.push("Mon"); } else if (doc.get("tuesday") != null) { weekdayList.push("Tue"); } else if (doc.get("wednesday") != null) { weekdayList.push("Wed"); } else if (doc.get("thursday") != null) { weekdayList.push("Thu"); } else if (doc.get("friday") != null) { weekdayList.push("Fri"); } else {} innerMushList.push(weekdayList); weekdayList = []; const time = doc.get("time"); innerMushList.push(time); const staff = doc.get("staff"); innerMushList.push(staff); mushList.push(innerMushList); innerMushList = []; }); } catch(error) { console.log(error); }

Cuando ejecuto el código en mi navegador, aparece el "punto de control 1" en mi consola. Sin embargo, el "Punto de control 2" no aparece en absoluto. La consola no me presenta ningún error. ¿Alguna idea sobre cómo solucionar este problema? Cuando ejecuto console.log(mushSnapshot) en el lugar del punto de control 1, la consola imprime un objeto etiquetado como "Mh". Por favor, vea la imagen adjunta.

salida de la consola

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!