lib/mongoid/persistable.rb in mongoid-6.4.8 vs lib/mongoid/persistable.rb in mongoid-7.0.0.beta
- old
+ new
@@ -160,14 +160,13 @@
# @return [ Hash ] The operations.
#
# @since 4.0.0
def process_atomic_operations(operations)
operations.each do |field, value|
- as_writable_attribute!(field, value) do |access|
- yield(access, value)
- remove_change(access)
- end
+ access = database_field_name(field)
+ yield(access, value)
+ remove_change(access)
end
end
# If we are in an atomically block, add the operations to the delayed group,
# otherwise persist immediately.
@@ -202,10 +201,10 @@
#
# @since 4.0.0
def persist_atomic_operations(operations)
if persisted? && operations
selector = atomic_selector
- _root.collection.find(selector).update_one(positionally(selector, operations), session: _session)
+ _root.collection.find(selector).update_one(positionally(selector, operations))
end
end
end
end