From 4242d496745612e67aa01679ed6d2b7d956aca16 Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Mon, 20 Nov 2017 15:00:25 -0500 Subject: [PATCH] fix(apm): rebuild lost `cursor` info on pre-OP_QUERY responses --- lib/apm.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/apm.js b/lib/apm.js index 3f1c90b18d..6c9bfd6b84 100644 --- a/lib/apm.js +++ b/lib/apm.js @@ -518,7 +518,9 @@ var Instrumentation = function(core, options, callback) { } else { if (r && r.documents) { r = r.documents[0]; - } else if (commandName.toLowerCase() === 'getmore' && r == null) { + } + + if (commandName.toLowerCase() === 'getmore' && r.cursor == null) { r = { cursor: { id: cursor.cursorState.cursorId, @@ -531,7 +533,7 @@ var Instrumentation = function(core, options, callback) { (commandName.toLowerCase() === 'find' || commandName.toLowerCase() === 'aggregate' || commandName.toLowerCase() === 'listcollections') && - r == null + r.cursor == null ) { r = { cursor: {