简体   繁体   中英

Firestore filtering multiple documents pricing

assume that 1000 documents in cities and only has 5 capitals are true. This query returned 5 results. Now my question is, will I be charged for 1000 document reads or 5 document reads for this query (without using .limit())?

db.collection("cities").where("capital", "==", true)
.get()
.then(function(querySnapshot) {
    querySnapshot.forEach(function(doc) {
        console.log(doc.id, " => ", doc.data());
    });
})
.catch(function(error) {
    console.log("Error getting documents: ", error);
});

Any help will be highly appreciated. Thank you.

You're charged for the number of documents you read, not the total number in the collection. So if you're only reading 5 documents, you're charged for 5 document reads.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM