Skip to content

Commit 96052c8

Browse files
committed
fix(apm): only rebuilt cursor if reply is non-null
1 parent 4242d49 commit 96052c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/apm.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ var Instrumentation = function(core, options, callback) {
520520
r = r.documents[0];
521521
}
522522

523-
if (commandName.toLowerCase() === 'getmore' && r.cursor == null) {
523+
if (commandName.toLowerCase() === 'getmore' && (r == null || r.cursor == null)) {
524524
r = {
525525
cursor: {
526526
id: cursor.cursorState.cursorId,
@@ -533,7 +533,7 @@ var Instrumentation = function(core, options, callback) {
533533
(commandName.toLowerCase() === 'find' ||
534534
commandName.toLowerCase() === 'aggregate' ||
535535
commandName.toLowerCase() === 'listcollections') &&
536-
r.cursor == null
536+
(r == null || r.cursor == null)
537537
) {
538538
r = {
539539
cursor: {

0 commit comments

Comments
 (0)