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

348
Views
¿Hay alguna forma de obtener un campo específico de una solicitud de obtención con Firestore (Firebase)?

Así que aquí está la solicitud para obtener algunos datos de Firestore con Vanilla JS.

 const q = query(collection(db, "tasks"), where("userId", "==", "Milos"), where("archive", "==", "false")); const querySnapshot = await getDocs(q); querySnapshot.forEach((doc) => { // doc.data() is never undefined for query doc snapshots console.log(doc.id, " => ", doc.data()); });``` With this request, I get a from collection tasks where userId equals "specificname", and where the archive field is equal to false. So with this request, I will get full tasks, is there some way with Firestore to get only a specific field or fields, not a full task with all fields? Is something even possible with Firestore or do I need to parse this object on the front side?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No, no puede recuperar respuestas parciales de Firestore en el cliente. Cada solicitud siempre devolverá todos los documentos al cliente. Esto también significa que no puede proteger ciertos campos en un documento.

Del lado del servidor, puede intentar usar Query.select .

 let collectionRef = firestore.collection('col'); let documentRef = collectionRef.doc('doc'); return documentRef.set({x:10, y:5}).then(() => { return collectionRef.where('x', '>', 5).select('y').get(); }).then((res) => { console.log(`y is ${res.docs[0].get('y')}.`); });
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!