diff --git a/lib/apm.js b/lib/apm.js index 6c9bfd6b84..5b9a3b2553 100644 --- a/lib/apm.js +++ b/lib/apm.js @@ -520,7 +520,7 @@ var Instrumentation = function(core, options, callback) { r = r.documents[0]; } - if (commandName.toLowerCase() === 'getmore' && r.cursor == null) { + if (commandName.toLowerCase() === 'getmore' && (r == null || r.cursor == null)) { r = { cursor: { id: cursor.cursorState.cursorId, @@ -533,7 +533,7 @@ var Instrumentation = function(core, options, callback) { (commandName.toLowerCase() === 'find' || commandName.toLowerCase() === 'aggregate' || commandName.toLowerCase() === 'listcollections') && - r.cursor == null + (r == null || r.cursor == null) ) { r = { cursor: {