Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4944

Insufficient testing for limit functionality

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0.rc1, 7.1.4, 7.0.10, 6.4.7
    • Affects Version/s: None
    • Component/s: None
    • None

      Currently, Mongoid's tests for QueryCache functionality when queries with different limits are executed are insufficient, since the collections are empty and therefore don't test if the correct amount of documents are being returned if the cache is used. 

      I don't believe the functionality is correct because in the case shown below, when the cache is used all of the stored cached_documents will still be iterated, not a limited subset of them. The QueryCache in driver should return the correct documents. 

      It is my understanding that the code on lines 250-252 of the cached_cursor method are unnecessary and should be removed, similar to the driver's implementation.

        1. cached_cursor method.png
          101 kB
          Grace Chong
        2. mongoid tests.png
          120 kB
          Grace Chong

            Assignee:
            emily.giurleo@mongodb.com Emily Giurleo (Inactive)
            Reporter:
            grace.chong@mongodb.com Grace Chong (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: