Closed spyr0s closed 1 month ago
@spyr0s if you run the query and store the result, can't you just run the size option on the array?
Example
var query: FirestoreQuery = FirestoreQuery.new()
query.from("players")
query.where("chipgamehandicap", FirestoreQuery.OPERATOR.GREATER_THAN, 4)
var result: Array = yield(Firebase.Firestore.query(query), "result_query")
print(result.size())
Or am I way off mark here?
@BearDooks - you should be right, but it might be weird with timing and stuff where it'll not be atomic I guess. I'll have to look into this closer, and am going to do so today while I work on the Firestore huge refactor!
@WolfgangSenff - It isn't the same, with query and size you will be charged by every document read, instead with count you will be charged 1 read every 1000*index documents. I'm interested in this implementation (count/sum/average aggregations). Thank you for this library!
@WolfgangSenff - It isn't the same, with query and size you will be charged by every document read, instead with count you will be charged 1 read every 1000*index documents. I would be interested in this implementation(count/sum/average aggregations). Thank you for this library!
Ah, interesting, okay, good point! I will eventually look into it, but just lost my job last week so am looking for a new job now. If you want to support the project and get the implementation sooner, that would be incredibly helpful. We do now support commits, which make atomic updates much cheaper! But it's obviously not the same. I'll post updates about it at https://patreon.com/KyleSzklenski.
Edit: Dang. Looking over the query stuff again, I'm tempted to rewrite the entire thing there as well. :/ It would be so much work, but looking at the code, it's more or less completely unmaintainable at this point, no way to add new stuff without breaking the old.
Alright, had a chance to dig into this, and it seems like it can be fixed without a rewrite. I will try to get to it within the next couple months I guess, if I can find a job that would be even better.
I've added the appropriate changes, but have not yet made a release. Never the less, I'm closing this for the time being. I'll release it when I have more time available. Fixed in #420
Is your feature request related to a problem? Please describe. I have a problem when I want to get a count of documents of a specific condition For example get the players that have a score > 10.000, or that signed in after a specific date etc
Describe the solution you'd like Support the count query of firestore
Describe alternatives you've considered No alternatives, getting all the documents paginated and count them is out of the question