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

Query cache returns narrowed down results when a previous query used #first

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0.rc0, 7.0.3
    • Affects Version/s: None
    • Component/s: Query
    • None
    • Environment:
      MacOS

      Here is reproducible codes:

      context 'when narrowed down results' do

        before do
          3.times do
            Person.create
          end
        end

        it do
          expect(Person.gt(age: 0).order_by(name: 1).to_a.count).to eq 3

          Person.gt(age: 0).order_by(name: 1).first

          expect(Person.gt(age: 0).order_by(name: 1).to_a.count).to eq 3
        end

      end

       

      2nd Person.gt(age: 0).order_by(name: 1).to_a.count is expected 3, but its actual is 1.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            pinarello.marvel@gmail.com 英雄 中野
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: