Skip to content

Commit 4242d49

Browse files
committed
fix(apm): rebuild lost cursor info on pre-OP_QUERY responses
1 parent 416497a commit 4242d49

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/apm.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,9 @@ var Instrumentation = function(core, options, callback) {
518518
} else {
519519
if (r && r.documents) {
520520
r = r.documents[0];
521-
} else if (commandName.toLowerCase() === 'getmore' && r == null) {
521+
}
522+
523+
if (commandName.toLowerCase() === 'getmore' && r.cursor == null) {
522524
r = {
523525
cursor: {
524526
id: cursor.cursorState.cursorId,
@@ -531,7 +533,7 @@ var Instrumentation = function(core, options, callback) {
531533
(commandName.toLowerCase() === 'find' ||
532534
commandName.toLowerCase() === 'aggregate' ||
533535
commandName.toLowerCase() === 'listcollections') &&
534-
r == null
536+
r.cursor == null
535537
) {
536538
r = {
537539
cursor: {

0 commit comments

Comments
 (0)