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

351
Views
Is there some way to get a specific field from one get request with Firestore(Firebase)?

So here is the request to get some data from Firestore with 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, you cannot retrieve partial responses from Firestore on the client. Every request will always return all documents to the client. This also means you cannot protect certain fields in a document.

Server-side you could try using 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!