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

103
Views
método de consulta de base de fuego donde cláusula con AND

Quiero hacer un WHERE foo = bar AND something = also_something en firebase

 export const getAllRoomsWhichHaveUnreadMessages = (currentUserId) => { return query( roomsRef, where(USERS_PATH, 'array-contains', currentUserId), where('unreadCount', '>', 0) ) }

¿Cómo encadeno WHERE y también cómo los recupero? Mi código anterior funciona pero solo genera una consulta, ¿cómo run la consulta?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Deberá usar el método getDocs para obtener una instantánea de la consulta.

A continuación, puede asignar los documentos de esa instantánea.

 import { query, where, getDocs } from "firebase/firestore"; export const getAllRoomsWhichHaveUnreadMessages = async (currentUserId) => { const q = query( roomsRef, where(USERS_PATH, "array-contains", currentUserId), where('unreadCount', '>', 0) ) const querySnap = await getDocs(q); return querySnap.docs.map((doc) => ({ id: doc.id, ...doc.data(), })); }

about 4 years ago · Santiago Gelvez 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!