class Mongo::Protocol::KillCursors

MongoDB Wire protocol KillCursors message.

This is a client request message that is sent to the server in order to kill a number of cursors.

@api semipublic

Constants

OP_CODE

The operation code required to specify KillCursors message. @return [Fixnum] the operation code.

@since 2.5.0

Attributes

upconverter[R]

Public Class Methods

new(collection, database, cursor_ids) click to toggle source

Creates a new KillCursors message

@example Kill the cursor on the server with id 1.

KillCursors.new([1])

@param [ Mongo::Database ] collection The collection. @param [ Mongo::Database ] database The database. @param [ Array<Fixnum> ] cursor_ids The cursor ids to kill.

Calls superclass method
# File lib/mongo/protocol/kill_cursors.rb, line 34
def initialize(collection, database, cursor_ids)
  @database = database
  @cursor_ids = cursor_ids
  @id_count   = @cursor_ids.size
  @upconverter = Upconverter.new(collection, cursor_ids)
  super
end

Public Instance Methods

payload() click to toggle source

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/kill_cursors.rb, line 50
def payload
  BSON::Document.new(
    command_name: 'killCursors',
    database_name: @database,
    command: upconverter.command,
    request_id: request_id,
  )
end