-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
# Will return the number of users named Jon User.with(:session => :replica_set).where(:first_name => "Jon").count() # Will return User.count User.where(:first_name => "Jon").with(:session => :replica_set).count()
Because Mongoid::Criteria's #with returns klass, the selector and options are negated. If the intention is to always call klass.with({}).where({}), then #with should be removed from Mongoid::Criteria to avoid mistakes that could lead to accidental massive updates, deletions, or long-running queries. Otherwise, #with should return the criteria.