@@ -76,12 +76,10 @@ export class OpQueryRequest {
7676 partial : boolean ;
7777 /** moreToCome is an OP_MSG only concept */
7878 moreToCome = false ;
79+ databaseName : string ;
80+ query : Document ;
7981
80- constructor (
81- public databaseName : string ,
82- public query : Document ,
83- options : OpQueryOptions
84- ) {
82+ constructor ( databaseName : string , query : Document , options : OpQueryOptions ) {
8583 // Basic options needed to be passed in
8684 // TODO(NODE-3483): Replace with MongoCommandError
8785 const ns = `${ databaseName } .$cmd` ;
@@ -97,7 +95,9 @@ export class OpQueryRequest {
9795 throw new MongoRuntimeError ( 'Namespace cannot contain a null character' ) ;
9896 }
9997
100- // Basic options
98+ // Basic optionsa
99+ this . databaseName = databaseName ;
100+ this . query = query ;
101101 this . ns = ns ;
102102
103103 // Additional options
@@ -496,17 +496,18 @@ export class OpMsgRequest {
496496 checksumPresent : boolean ;
497497 moreToCome : boolean ;
498498 exhaustAllowed : boolean ;
499+ databaseName : string ;
500+ command : Document ;
501+ options : OpQueryOptions ;
499502
500- constructor (
501- public databaseName : string ,
502- public command : Document ,
503- public options : OpQueryOptions
504- ) {
503+ constructor ( databaseName : string , command : Document , options : OpQueryOptions ) {
505504 // Basic options needed to be passed in
506505 if ( command == null )
507506 throw new MongoInvalidArgumentError ( 'Query document must be specified for query' ) ;
508507
509- // Basic options
508+ // Basic optionsa
509+ this . databaseName = databaseName ;
510+ this . command = command ;
510511 this . command . $db = databaseName ;
511512
512513 // Ensure empty options
@@ -730,10 +731,19 @@ const COMPRESSION_DETAILS_SIZE = 9; // originalOpcode + uncompressedSize, compre
730731 * An OP_COMPRESSED request wraps either an OP_QUERY or OP_MSG message.
731732 */
732733export class OpCompressedRequest {
734+ private command : WriteProtocolMessageType ;
735+ private options : { zLibCompressionLevel : number ; agreedCompressor : CompressorName } ;
736+
733737 constructor (
734- private command : WriteProtocolMessageType ,
735- private options : { zlibCompressionLevel : number ; agreedCompressor : CompressorName }
736- ) { }
738+ command : WriteProtocolMessageType ,
739+ options : { zlibCompressionLevel : number ; agreedCompressor : CompressorName }
740+ ) {
741+ this . command = command ;
742+ this . options = {
743+ zLibCompressionLevel : options . zlibCompressionLevel ,
744+ agreedCompressor : options . agreedCompressor
745+ } ;
746+ }
737747
738748 // Return whether a command contains an uncompressible command term
739749 // Will return true if command contains no uncompressible command terms
@@ -752,7 +762,13 @@ export class OpCompressedRequest {
752762 const originalCommandOpCode = concatenatedOriginalCommandBuffer . readInt32LE ( 12 ) ;
753763
754764 // Compress the message body
755- const compressedMessage = await compress ( this . options , messageToBeCompressed ) ;
765+ const compressedMessage = await compress (
766+ {
767+ zlibCompressionLevel : this . options . zLibCompressionLevel ,
768+ agreedCompressor : this . options . agreedCompressor
769+ } ,
770+ messageToBeCompressed
771+ ) ;
756772 // Create the msgHeader of OP_COMPRESSED
757773 const msgHeader = Buffer . alloc ( MESSAGE_HEADER_SIZE ) ;
758774 msgHeader . writeInt32LE (
0 commit comments