Class | Moped::Protocol::Insert |
In: |
lib/moped/protocol/insert.rb
|
Parent: | Object |
The Protocol class for inserting documents into a collection.
@example
insert = Insert.new "moped", "people", [{ name: "John" }]
@example Continuing after an error on batch insert
insert = Insert.new "moped", "people", [{ unique_field: 1 }, { unique_field: 1 }, { unique_field: 2 }], flags: [:continue_on_error]
@example Setting the request id
insert = Insert.new "moped", "people", [{ name: "John" }], request_id: 123
collection | [R] | @return [String, Symbol] the collection this insert targets |
database | [R] | @return [String, Symbol] the database this insert targets |
Create a new insert command. The database and collection arguments are joined together to set the full_collection_name.
@example
Insert.new "moped", "users", [{ name: "John" }], flags: [:continue_on_error], request_id: 123
@param [String, Symbol] database the database to insert into @param [String, Symbol] collection the collection to insert into @param [Array<Hash>] documents the documents to insert @param [Hash] options additional options @option options [Number] :request_id the command‘s request id @option options [Array] :flags the flags for insertion. Supported
flags: +:continue_on_error+