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?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')}.`); });