Class: Mongo::Protocol::KillCursors

Inherits:
Message
  • Object
show all
Defined in:
lib/mongo/protocol/kill_cursors.rb

Overview

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.

Defined Under Namespace

Classes: Upconverter

Constant Summary

Constants inherited from Message

Message::BATCH_SIZE, Message::COLLECTION, Message::LIMIT, Message::MAX_MESSAGE_SIZE, Message::ORDERED, Message::Q

Instance Attribute Summary

Attributes inherited from Message

#request_id

Instance Method Summary collapse

Methods inherited from Message

#==, deserialize, #hash, #replyable?, #serialize, #set_request_id

Constructor Details

#initialize(collection, database, cursor_ids) ⇒ KillCursors

Creates a new KillCursors message

Examples:

Kill the cursor on the server with id 1.

KillCursors.new([1])

Parameters:

  • collection (Mongo::Database)

    The collection.

  • database (Mongo::Database)

    The database.

  • cursor_ids (Array<Fixnum>)

    The cursor ids to kill.



34
35
36
37
38
39
40
# 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

Instance Method Details

#payloadHash

Return the event payload for monitoring.

Examples:

Return the event payload.

message.payload

Returns:

  • (Hash)

    The event payload.

Since:

  • 2.1.0



50
51
52
53
54
55
56
57
# File 'lib/mongo/protocol/kill_cursors.rb', line 50

def payload
  {
    command_name: 'killCursors',
    database_name: @database,
    command: upconverter.command,
    request_id: request_id
  }
end