I want to get the age field of all documents. At the moment, I am using:
await collection.get().then((value) {
for (QueryDocumentSnapshot doc in value.docs) {
print(doc.get('age'));
}
});
This method gets all fields of the document and then get specific field by using .get('age')
. I don't want to get big data and then filter it.
The firebase has the .doc('')
function to get specific documents but I don't found something like .field([''])
to get these fields that I want.
Is it possible to get the specific fields that I selected?