I want to order by rating among all of the 1000+ users in my snapshot listener, and take the highest 3 of the results. I don’t know if it will be a plus to use limit()
here. The docs are not clear enough to understand the costs. My code to fetch is:
const unsubscribe = onSnapshot(query(collection(db, "users"), where("city", "==", user.city), orderBy("rating", "desc")) ),
(snapshot) => {....}
In this situation, how many read/write operations will I be charged for? Will it be 1000 or 3? Also, the second question is, what is the most cost-effective way to do this? If I need to obtain best 3 rating users, should I exactly have to make read operations for all 1000 documents and get charged for 1000 reads? I am trying to find a clear answer to this.