class Mongo::Protocol::Delete
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
Constants
Attributes
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+
# File lib/mongo/protocol/delete.rb, line 43 def initialize(database, collection, selector, options = {}) @database = database @namespace = "#{database}.#{collection}" @selector = selector @flags = options[:flags] || [] @upconverter = Upconverter.new(collection, selector, options) super end
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
# File lib/mongo/protocol/delete.rb, line 60 def payload BSON::Document.new( command_name: 'delete', database_name: @database, command: upconverter.command, request_id: request_id ) end