-
Type: Bug
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: None
-
Component/s: Persistence
-
None
-
Minor Change
When I useĀ `Mongoid.purge!` and `Mongoid.truncate` I would expect the method to use the `Mongoid.override_database`
Example
require 'mongoid' Mongoid.connect_to 'bugs' class Something include Mongoid::Document field :doesnt_matter, type: String, default: '' end puts "----Testing purge!----" Something.create!(doesnt_matter: 'test-purge') puts " Expect: 1, Actual: #{Something.count}" Mongoid.purge! puts " Expect: 0, Actual: #{Something.count}" puts "----Testing truncate!----" Something.create!(doesnt_matter: 'test-truncate') puts " Expect: 1, Actual: #{Something.count}" Mongoid.truncate! puts " Expect: 0, Actual: #{Something.count}" Mongoid.override_database('bugs_1') puts "----Testing purge! with override db----" Something.create!(doesnt_matter: 'test-purge-ov') puts " Expect: 1, Actual: #{Something.count}" Mongoid.purge! puts " Expect: 0, Actual: #{Something.count}" puts "----Testing truncate! with override db----" Something.create!(doesnt_matter: 'test-truncate-ov') puts " Expect: 1, Actual: #{Something.count}" Mongoid.truncate! puts " Expect: 0, Actual: #{Something.count}"