Class Moped::Protocol::Delete
In: lib/moped/protocol/delete.rb
Parent: Object

The Protocol class for deleting documents from a collection.

@example Delete all people named John

  delete = Delete.new "moped", "people", { name: "John" }

@example Delete the first person named John

  delete = Delete.new "moped", "people", { name: "John" },
    flags: [:remove_first]

@example Setting the request id

  delete = Delete.new "moped", "people", { name: "John" },
    request_id: 123

Methods

log_inspect   new   op_code  

Included Modules

Message

Attributes

collection  [R]  @return [String, Symbol] the collection to delete from
database  [R]  @return [String, Symbol] the database to delete from

Public Class methods

Create a new delete command. The database and collection arguments are joined together to set the full_collection_name.

@example

  Delete.new "moped", "users", { condition: true },
    flags: [:remove_first],
    request_id: 123

@param [String, Symbol] database the database to delete from @param [String, Symbol] collection the collection to delete from @param [Hash] selector the selector for which documents to delete @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: +:remove_first+

Public Instance methods

@return [Number] OP_DELETE operation code (2006)

[Validate]