Sha256: f259472e7782dadbecc7ce2b0eb10491ae17db323f226f4ab554faf59bcd891e
Contents?: true
Size: 659 Bytes
Versions: 13
Compression:
Stored size: 659 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Modifiers #:nodoc: class Inc < Command #:nodoc: # Execute the persistence operation. This will increment the provided # field by the supplied value. If no field exists, it will be created and # set to the value provided. # # Options: # # field: The field to increment. # value: The number to increment by. def persist(field, value) @document.collection.update( @document._selector, { "$inc" => { field => value } }, :safe => safe_mode?(@options), :multi => false ) end end end end
Version data entries
13 entries across 13 versions & 2 rubygems