模块:Mongoid::Persistable::Unsettable
Overview
定义 $unset 操作的行为。
实例方法摘要折叠
-
# unset (*fields) ⇒ 文档
对提供的字段和内存中文档的值执行 $unset 操作。
实例方法详细信息
# unset (*fields) ⇒文档
对提供的字段和内存中文档的值执行 $unset 操作。
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mongoid/persistable/unsettable.rb', line 21 def 未设置(*字段) prepare_atomic_operation do |运维| 字段.展平.每 do |字段| 标准化 = database_field_name(字段) if Executing_atomically? process_attribute 标准化, nil else 属性.删除(标准化) end 运维[atomic_attribute_name(标准化)] = true end { " $unset " => 运维 } end end |