Method: Mongoid::Persistence::Operations.insert

Defined in:
lib/mongoid/persistence/operations.rb

.insert(doc, options = {}) ⇒ Operations

Get the appropriate insertion operation based on the document.

Examples:

Get the insertion operation.

Operations.insert(doc, options)

Parameters:

  • doc (Document)

    The document to persist.

  • options (Hash) (defaults to: {})

    The persistence options.

Returns:

Since:

  • 2.1.0



190
191
192
# File 'lib/mongoid/persistence/operations.rb', line 190

def insert(doc, options = {})
  (doc.embedded? ? Embedded::Insert : Insert).new(doc, options)
end