lib/mongoid/persistence.rb
# Upsert the document - will perform an insert if the document is new, and
# update if not.
#
# @example Upsert the document.
#   document.upsert
#
# @param [ Hash ] options Options to pass to the upsert.
#
# @return [ true, false ] True is success, false if not.
Upsert the document - will perform an insert if the document is new, and
update if not.
Upsert the document - will perform an insert if the document is new and update if not .
def upsert(options = {})
      if new_record?
        insert(options).persisted?
      else
        update(options)
      end
    end
def upsert ( options = { } ) if new_record? insert ( options ) . persisted? else update ( options ) end end
Upsert the document - will perform an insert if the document is new, and
update if not.
Upsert the document - will perform an insert if the document is new and update if not .
True is success, false if not.
True is success false if not .
 true, false 
options
<not_specific>
<not_specific>
options Options to pass to the upsert.
options Options to pass to the upsert .
example
Upsert the document. document.upsert
Upsert the document . document . upsert