-
Type:
Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Behavior was definitely different in 2.0.2 from 2.4.0.
require "spec_helper" class Foo include Mongoid::Document end describe "Test" do before do [ Foo ].each(&:delete_all) end describe "works" do it "sometimes" do 2.times { Foo.create! } Foo.count.should == 2 Foo.limit(1).to_a.length.should == 1 Foo.limit(1).count.should == 1 # fails, returns 2 end end end
Am I missing something? How do I get the count of the objects for a criteria with a limit without actually executing the full query that returns the documents?