-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Utility method for counting entities. #126
Comments
Hello, |
I have to agree with Sébastien.
Although I don't think there is harm in having a basic counter query
implemented into the library for convenience sake, I don't think using this
technique is the most efficient for most Datastore use cases. But then
again, it entirely depends on how your business data is structured and how
the developer decides is the best way to handle it.
That being said, I do think it's worth adding basic counter to the library
because it is only a negligible amount of code, but adds for a pretty
convenient feature for those that need it.
…On Tue, Sep 11, 2018, 6:29 AM Sébastien Loix ***@***.***> wrote:
Hello,
I am not sure this would be the best practice to implement a counter. I
would go either by saving the entities in an entity group under an ancestor
entity that has a count property (an update this count property in a
transaction when creating or deleting an entity). If there is a lot of
write I would go with a sharding counter (
https://cloud.google.com/appengine/articles/sharding_counters)
What do you think?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#126 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGOnw1j2HMKAcbGnlasYOZ4GmKOsh8Vbks5uZ5BsgaJpZM4WitGE>
.
|
Yeah, I am not against adding a utiliy helper for a counter like @huysamen suggests. I think we would then need to indicate in the Docs other options that might be more efficient according to the use cases. |
Like the
.list()
method, but maybe just select the keys and return the count. I will try and do the implementation sometime and make a PR.The text was updated successfully, but these errors were encountered: