Skip to content
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

"count" takes a very long time #10

Open
thbar opened this issue Jan 7, 2011 · 4 comments
Open

"count" takes a very long time #10

thbar opened this issue Jan 7, 2011 · 4 comments
Labels

Comments

@thbar
Copy link

thbar commented Jan 7, 2011

Hello,

I just noticed (thanks to my growing base!) that for a given Item < Mongomatic::Base, Item.count will take a long time (37 seconds in my example). After browsing the code I suspect that count is going through all the documents to count them (count is doing find.count).

Using Item.collection.count instead is very fast.

I'm currently using Mongomatic 0.5.8.

@benmyles
Copy link
Owner

benmyles commented Jan 7, 2011

Yep, you should use .collection.count, bugfix will be forthcoming so that .count uses that too.

@thbar
Copy link
Author

thbar commented Jan 7, 2011

In the mean time, a simple doc patch is enough if you prefer :)

Thanks for your work on Mongomatic!

@jsmestad
Copy link
Contributor

jsmestad commented Apr 6, 2011

@benmyles what was the suggested fix for this?

@thbar
Copy link
Author

thbar commented Apr 6, 2011

@jsmestad: looking at the code quickly I believe the fix is still to use .collection.count directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants