Class: Mongo::Operation::Write::Insert

Inherits:
Object
  • Object
show all
Includes:
Specifiable, GLE, Idable, WriteCommandEnabled
Defined in:
lib/mongo/operation/write/insert.rb,
lib/mongo/operation/write/insert/result.rb

Overview

Note:

If a server with version >= 2.5.5 is being used, a write command operation will be created and sent instead.

A MongoDB insert operation.

Initialization:

param [ Hash ] spec The specifications for the insert.

option spec :documents [ Array ] The documents to insert.
option spec :db_name [ String ] The name of the database.
option spec :coll_name [ String ] The name of the collection.
option spec :write_concern [ Mongo::WriteConcern ] The write concern.
option spec :options [ Hash ] Options for the command, if it ends up being a
  write command.

Examples:

Create the new insert operation.

Write::Insert.new({
  :documents => [{ :foo => 1 }],
  :db_name => 'test',
  :coll_name => 'test_coll',
  :write_concern => write_concern
})

Since:

  • 2.0.0

Defined Under Namespace

Classes: Result

Constant Summary

Constants included from Idable

Mongo::Operation::Write::Idable::ID_GENERATOR

Constants included from Specifiable

Specifiable::BYPASS_DOC_VALIDATION, Specifiable::COLLATION, Specifiable::COLL_NAME, Specifiable::CURSOR_COUNT, Specifiable::CURSOR_ID, Specifiable::CURSOR_IDS, Specifiable::DB_NAME, Specifiable::DELETE, Specifiable::DELETES, Specifiable::DOCUMENTS, Specifiable::INDEX, Specifiable::INDEXES, Specifiable::INDEX_NAME, Specifiable::MAX_TIME_MS, Specifiable::OPERATION_ID, Specifiable::OPTIONS, Specifiable::READ, Specifiable::READ_CONCERN, Specifiable::SELECTOR, Specifiable::TO_RETURN, Specifiable::UPDATE, Specifiable::UPDATES, Specifiable::USER, Specifiable::USER_NAME, Specifiable::WRITE_CONCERN

Instance Attribute Summary

Attributes included from Specifiable

#spec

Method Summary

Methods included from Idable

#id_generator

Methods included from Specifiable

#==, #bypass_document_validation, #coll_name, #collation, #cursor_count, #cursor_id, #cursor_ids, #db_name, #delete, #deletes, #documents, #index, #index_name, #indexes, #initialize, #max_time_ms, #namespace, #operation_id, #options, #ordered?, #read, #read_concern, #selector, #to_return, #update, #updates, #user, #user_name, #write_concern

Methods included from WriteCommandEnabled

#execute