UPGRADING.md in mongoid-locker-1.0.1 vs UPGRADING.md in mongoid-locker-2.0.0

- old
+ new

@@ -1,7 +1,26 @@ -## Upgrading Mongoid Locker +## Upgrading Mongoid-Locker +## Upgrading to 2.0.0 + +Mongoid-Locker supports only `5`, `6` and `7` versions of Mongoid. +Since this version `Mongoid::Locker` uses unique name of locking and time is set by MongoDB. `Mongoid::Locker` no longer uses `locked_until` field and this field may be deleted with `User.all.unset(:locked_until)`. You must define new `locking_name` field of `String` type. + +```ruby +class User + include Mongoid::Document + include Mongoid::Locker + + field :locking_name, type: String + field :locked_at, type: Time +end +``` + +The options `:timeout` and `retry_sleep` of `#with_lock` method was deprecated and have no effect. For details see [RubyDoc.info](https://www.rubydoc.info/gems/mongoid-locker/2.0.0/Mongoid/Locker#with_lock-instance_method). +If you handle `Mongoid::Locker::LockError` error then this error should be renamed to `Mongoid::Locker::Errors::DocumentCouldNotGetLock`. + ### Upgrading to 1.0.0 + `Mongoid::Locker` no longer defines `locked_at` and `locked_until` fields when included. You must define these fields manually. ```ruby class User include Mongoid::Document