问题
I want to query a firestore documents collection and want only retrieve the document ids with angularfire2, to save costs for reading all documents.
As far as I understand it, the following code is retrieving all documents too and is causing read ops on all documents, no matter if I use doc.data()
or not. Am I right?
db.collection("cities").where("capital", "==", true).onSnapshot(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
console.log(doc.id);
}
});
So in the documentation it is stated:
For queries other than document reads, such as a request for a list of collection IDs, you are billed for one document read.
Is there a way with angularfire2 to query a collection and retrieve only the document IDs?
Or is there an other way than using angularfire2?
来源:https://stackoverflow.com/questions/49880839/firestore-query-collection-using-where-and-only-retrieve-document-ids