class Mongo::Protocol::Reply

The MongoDB wire protocol message representing a reply

@example

socket = TCPSocket.new('localhost', 27017)
query = Protocol::Query.new('xgen', 'users', {:name => 'Tyler'})
socket.write(query)
reply = Protocol::Reply::deserialize(socket)

@api semipublic

Constants

FLAGS

Available flags for a Reply message.

OP_CODE

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

@since 2.5.0

Public Instance Methods

cursor_not_found?() click to toggle source

Determine if the reply had a cursor not found flag.

@example Did the reply have a cursor not found flag.

reply.cursor_not_found?

@return [ true, false ] If the query cursor was not found.

@since 2.2.3

# File lib/mongo/protocol/reply.rb, line 49
def cursor_not_found?
  flags.include?(:cursor_not_found)
end
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/reply.rb, line 61
def payload
  BSON::Document.new(
    reply: upconverter.command,
    request_id: request_id
  )
end
query_failure?() click to toggle source

Determine if the reply had a query failure flag.

@example Did the reply have a query failure.

reply.query_failure?

@return [ true, false ] If the query failed.

@since 2.0.5

# File lib/mongo/protocol/reply.rb, line 37
def query_failure?
  flags.include?(:query_failure)
end

Private Instance Methods

upconverter() click to toggle source
# File lib/mongo/protocol/reply.rb, line 70
def upconverter
  @upconverter ||= Upconverter.new(documents, cursor_id, starting_from)
end