@@ -438,7 +438,7 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
438
438
zlibCompressionLevel : this . description . zlibCompressionLevel
439
439
} ) ;
440
440
441
- if ( options . noResponse ) {
441
+ if ( options . noResponse || ( 'moreToCome' in message && message . moreToCome ) ) {
442
442
yield MongoDBResponse . empty ;
443
443
return ;
444
444
}
@@ -500,13 +500,9 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
500
500
let document : MongoDBResponse | undefined = undefined ;
501
501
/** Cached result of a toObject call */
502
502
let object : Document | undefined = undefined ;
503
- const wireOptions = options ;
504
- if ( message instanceof OpMsgRequest ) {
505
- wireOptions . noResponse = options . noResponse || message . moreToCome ;
506
- }
507
503
try {
508
504
this . throwIfAborted ( ) ;
509
- for await ( document of this . sendWire ( message , wireOptions , responseType ) ) {
505
+ for await ( document of this . sendWire ( message , options , responseType ) ) {
510
506
object = undefined ;
511
507
if ( options . session != null ) {
512
508
updateSessionFromResponse ( options . session , document ) ;
@@ -530,7 +526,11 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
530
526
new CommandSucceededEvent (
531
527
this ,
532
528
message ,
533
- wireOptions . noResponse ? { ok : 1 } : ( object ??= document . toObject ( bsonOptions ) ) ,
529
+ options . noResponse
530
+ ? undefined
531
+ : 'moreToCome' in message && message . moreToCome
532
+ ? { ok : 1 }
533
+ : ( object ??= document . toObject ( bsonOptions ) ) ,
534
534
started ,
535
535
this . description . serverConnectionId
536
536
)
0 commit comments