Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.52 KB

UPGRADING.md

File metadata and controls

34 lines (26 loc) · 1.52 KB

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.

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. 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.

class User
  include Mongoid::Document
  include Mongoid::Locker

  field :locked_at, type: Time
  field :locked_until, type: Time
end

You can customize the fields used with a locker class method or via a global configure. See Customizable :locked_at and :locked_until field names for more information.

See #55 for more information.