mongoid/mongoid — Issue #1584: Criteria.count doesn't respect limit
Author: dblock
Created: 2012-01-11 15:49:14+00:00
State: open

Behavior was definitely different in 2.0.2.

```
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?