Class: Mongo::Protocol::KillCursors

Inherits:
Message
  • Object
show all
Defined in:
build/ruby-driver-v2.19/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, #maybe_add_server_api, #maybe_compress, #maybe_decrypt, #maybe_encrypt, #maybe_inflate, #number_returned, #replyable?, #serialize, #set_request_id

Methods included from Id

included

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.



37
38
39
40
41
42
43
# File 'build/ruby-driver-v2.19/lib/mongo/protocol/kill_cursors.rb', line 37

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

#payloadBSON::Document

Return the event payload for monitoring.

Examples:

Return the event payload.

message.payload

Returns:

  • (BSON::Document)

    The event payload.

Since:

  • 2.1.0



53
54
55
56
57
58
59
60
# File 'build/ruby-driver-v2.19/lib/mongo/protocol/kill_cursors.rb', line 53

def payload
  BSON::Document.new(
    command_name: 'killCursors',
    database_name: @database,
    command: upconverter.command,
    request_id: request_id,
  )
end