-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 7.0.4, 7.0.5
-
Component/s: Query
-
None
Hello,
First, I don’t really know since which version the issue occurs; but on a Rails project (Prod env) we have the issue with the previous version (7.0.4) but with a different error message.
So, when `Mongoid::QueryCache` is `enabled`, all requests with a response larger than the `batch_size` cannot be called twice, even without one explicitly set.
When calling it twice, it raises a `NotImplementedError: Cannot restart iteration of a cursor which issued a getMore`.
I also tried with several older combo versions of Mongoid and Mongo driver and it raises: `Mongo::Error::OperationFailure (Cursor not found, cursor id: 140000000000 (40))`.
I've seen in the source code that `Mongoid::QueryCache` is supposed to handle requests using `getMore` with a patch on the mongo driver. The problem is that it isn’t working as expected. The `process` method looks correctly overrided but I didn’t go deeper.
To ensure this issue can be reproduced, I have created a minimal project: guille-moe/mongoid-query-cache-test
A typical example with the issue can be found here: guille-moe/mongoid-query-cache-test/spec/models/user_spec.rb
- duplicates
-
RUBY-2338 Allow cursors to be iterated more than once
- Closed
- is duplicated by
-
MONGOID-4978 Query cache: "Cannot restart iteration of a cursor which issued a getMore"
- Closed