lib/mongo/monitoring/event/command_succeeded.rb in mongo-2.1.0.rc0 vs lib/mongo/monitoring/event/command_succeeded.rb in mongo-2.1.0
- old
+ new
@@ -18,10 +18,11 @@
# Event that is fired when a command operation succeeds.
#
# @since 2.1.0
class CommandSucceeded
+ include Secure
# @return [ Server::Address ] address The server address.
attr_reader :address
# @return [ String ] command_name The name of the command.
@@ -59,11 +60,11 @@
@command_name = command_name
@database_name = database_name
@address = address
@request_id = request_id
@operation_id = operation_id
- @reply = reply
+ @reply = redacted(command_name, reply)
@duration = duration
end
# Create the event from a wire protocol message payload.
#
@@ -95,14 +96,16 @@
def self.generate_reply(command_payload, reply_payload)
if reply_payload
reply = reply_payload[:reply]
if cursor = reply[:cursor]
- reply = reply.merge(cursor: cursor.merge(ns: namespace(command_payload)))
+ if !cursor.key?(Collection::NS)
+ cursor.merge!(Collection::NS => namespace(command_payload))
+ end
end
reply
else
- BSON::Document.new(ok: 1)
+ BSON::Document.new(Operation::Result::OK => 1)
end
end
def self.namespace(payload)
command = payload[:command]