-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
It seems like #with works inconsistently between 3.1.6 and 4.0.0.beta1.
Mongoid 3.1.6, moped 1.5.2:
15.times { User.create!(salary: 1) } 10.times { User.with(database: "other_db").create!(salary: 1) } User.count # => 15 User.with(database: "other_db").count # => 10 - good. User.with(database: "other_db").all.count # => 10 - good. User.all.with(database: "other_db").count # => 10 - good.
Mongoid 4.0.0.beta1, moped 2.0.0.beta6:
15.times { User.create!(salary: 1) } 10.times { User.with(database: "other_db").create!(salary: 1) } User.count # => 15 User.with(database: "other_db").count # => 10 - good. User.with(database: "other_db").all.count # => 15 - It should be 10. User.all.with(database: "other_db").count # => 10 - good.
Both ran on Ruby 2.1.1:
$ ruby -v ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
Was this behaviour changed intentionally?