Skip to content

Commit

Permalink
spreading changes
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Jan 15, 2025
1 parent 13ca440 commit 953a387
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/cmap/command_monitoring_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ const OP_QUERY_KEYS = [
/** Extract the actual command from the query, possibly up-converting if it's a legacy format */
function extractCommand(command: WriteProtocolMessageType): Document {
if (command instanceof OpMsgRequest) {
const cmd = deepCopy(command.command);
const cmd = { ...command.command };
// For OP_MSG with payload type 1 we need to pull the documents
// array out of the document sequence for monitoring.
if (cmd.ops instanceof DocumentSequence) {
Expand Down Expand Up @@ -326,22 +326,22 @@ function extractReply(command: WriteProtocolMessageType, reply?: Document) {
}

if (command instanceof OpMsgRequest) {
return deepCopy(reply.result ? reply.result : reply);
return reply.result ? reply.result : reply;
}

// is this a legacy find command?
if (command.query && command.query.$query != null) {
return {
ok: 1,
cursor: {
id: deepCopy(reply.cursorId),
id: reply.cursorId,
ns: namespace(command),
firstBatch: deepCopy(reply.documents)
firstBatch: reply.documents
}
};
}

return deepCopy(reply.result ? reply.result : reply);
return reply.result ? reply.result : reply;
}

function extractConnectionDetails(connection: Connection) {
Expand Down

0 comments on commit 953a387

Please sign in to comment.