Module: Mongoid::Locking::Selectable
- Defined in:
- lib/mongoid/locking/selectable.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#atomic_selector(skip_lock_version: false) ⇒ Object
Overrides the default Mongoid::Selectable#atomic_selector to not memoize its result.
-
#root_atomic_selector(skip_lock_version: false) ⇒ Hash
private
Get the atomic selector for a root document.
Instance Method Details
#atomic_selector(skip_lock_version: false) ⇒ Object
Overrides the default Mongoid::Selectable#atomic_selector to not memoize its result.
It is required when saving the same object multiple times in a row.
8 9 10 |
# File 'lib/mongoid/locking/selectable.rb', line 8 def atomic_selector(skip_lock_version: false) ? : root_atomic_selector(skip_lock_version: skip_lock_version) end |
#root_atomic_selector(skip_lock_version: false) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the atomic selector for a root document.
github.com/mongodb/mongoid/blob/7.2-stable/lib/mongoid/selectable.rb#L57
23 24 25 26 27 |
# File 'lib/mongoid/locking/selectable.rb', line 23 def root_atomic_selector(skip_lock_version: false) return { "_id" => id, "lock_version" => lock_version }.merge!(shard_key_selector) unless skip_lock_version { "_id" => id }.merge!(shard_key_selector) end |