I am using admin_assistant and have hacked on MongoDB support. The only issue now is that the index page queries are incredibly slow. admin_assistant uses will_paginate for these queries. I verified that the exact slow-down spot is where the will paginate collection is first accessed (.empty?). In the log I see the query, and after that I see these being slowly printed:
MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755 MONGODB cursor.refresh() for cursor 3474711247518436755
I will probably try getting rid of will_paginate next, but the rest of the code is depending on it right now. Any ideas on what could cause the cursor refreshes?
empty?
method, so calling empty? on it triggers fetching results and yielding array of docs. You should post it to will_paginate or mongoid list and meanwhile hackcriteria#empty?
to testcriteria#count(true) == 0
– Phosphocreatineeach
will have the same behavior asempty?
if my guess is correct, you should trycount
to see if it also leads to same situation(it shouldn't). – Phosphocreatine