Class Mongo::Protocol::Delete
In: lib/mongo/protocol/delete.rb
Parent: Message

MongoDB Wire protocol Delete message.

This is a client request message that is sent to the server in order to delete selected documents in the specified namespace.

The operation, by default, operates on many documents. Setting the +:single_remove+ flag allows for a single matching document to be removed.

@api semipublic

Methods

new   payload  

Classes and Modules

Class Mongo::Protocol::Delete::Upconverter

Constants

OP_CODE = 2006   The operation code required to specify a Delete message. @return [Fixnum] the operation code.

@since 2.5.0

FLAGS = [:single_remove]   Available flags for a Delete message.

Attributes

upconverter  [R] 

Public Class methods

Creates a new Delete message

@example Remove all users named Tyler.

  Query.new('xgen', 'users', {:name => 'Tyler'})

@param database [String, Symbol] The database to remove from. @param collection [String, Symbol] The collection to remove from. @param selector [Hash] The query used to select doc(s) to remove. @param options [Hash] The additional delete options.

@option options :flags [Array] The flags for the delete message.

  Supported flags: +:single_remove+

Public Instance methods

Return the event payload for monitoring.

@example Return the event payload.

  message.payload

@return [ BSON::Document ] The event payload.

@since 2.1.0

[Validate]