Skip to content

Commit

Permalink
fix(apm): only rebuilt cursor if reply is non-null
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Nov 20, 2017
1 parent 4242d49 commit 96052c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/apm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: {
Expand Down

0 comments on commit 96052c8

Please sign in to comment.