@@ -491,6 +491,7 @@ export class Response {
491491 promoteLongs : boolean ;
492492 promoteValues : boolean ;
493493 promoteBuffers : boolean ;
494+ bsonRegExp ?: boolean ;
494495 index ?: number ;
495496
496497 constructor (
@@ -502,7 +503,12 @@ export class Response {
502503 this . parsed = false ;
503504 this . raw = message ;
504505 this . data = msgBody ;
505- this . opts = opts ?? { promoteLongs : true , promoteValues : true , promoteBuffers : false } ;
506+ this . opts = opts ?? {
507+ promoteLongs : true ,
508+ promoteValues : true ,
509+ promoteBuffers : false ,
510+ bsonRegExp : false
511+ } ;
506512
507513 // Read the message header
508514 this . length = msgHeader . length ;
@@ -530,6 +536,7 @@ export class Response {
530536 typeof this . opts . promoteValues === 'boolean' ? this . opts . promoteValues : true ;
531537 this . promoteBuffers =
532538 typeof this . opts . promoteBuffers === 'boolean' ? this . opts . promoteBuffers : false ;
539+ this . bsonRegExp = typeof this . opts . bsonRegExp === 'boolean' ? this . opts . bsonRegExp : false ;
533540 }
534541
535542 isParsed ( ) : boolean {
@@ -547,13 +554,15 @@ export class Response {
547554 const promoteLongs = options . promoteLongs ?? this . opts . promoteLongs ;
548555 const promoteValues = options . promoteValues ?? this . opts . promoteValues ;
549556 const promoteBuffers = options . promoteBuffers ?? this . opts . promoteBuffers ;
557+ const bsonRegExp = options . bsonRegExp ?? this . opts . bsonRegExp ;
550558 let bsonSize ;
551559
552560 // Set up the options
553561 const _options : BSONSerializeOptions = {
554- promoteLongs : promoteLongs ,
555- promoteValues : promoteValues ,
556- promoteBuffers : promoteBuffers
562+ promoteLongs,
563+ promoteValues,
564+ promoteBuffers,
565+ bsonRegExp
557566 } ;
558567
559568 // Position within OP_REPLY at which documents start
@@ -765,6 +774,7 @@ export class BinMsg {
765774 promoteLongs : boolean ;
766775 promoteValues : boolean ;
767776 promoteBuffers : boolean ;
777+ bsonRegExp : boolean ;
768778 documents : ( Document | Buffer ) [ ] ;
769779 index ?: number ;
770780
@@ -777,7 +787,12 @@ export class BinMsg {
777787 this . parsed = false ;
778788 this . raw = message ;
779789 this . data = msgBody ;
780- this . opts = opts ?? { promoteLongs : true , promoteValues : true , promoteBuffers : false } ;
790+ this . opts = opts ?? {
791+ promoteLongs : true ,
792+ promoteValues : true ,
793+ promoteBuffers : false ,
794+ bsonRegExp : false
795+ } ;
781796
782797 // Read the message header
783798 this . length = msgHeader . length ;
@@ -796,6 +811,7 @@ export class BinMsg {
796811 typeof this . opts . promoteValues === 'boolean' ? this . opts . promoteValues : true ;
797812 this . promoteBuffers =
798813 typeof this . opts . promoteBuffers === 'boolean' ? this . opts . promoteBuffers : false ;
814+ this . bsonRegExp = typeof this . opts . bsonRegExp === 'boolean' ? this . opts . bsonRegExp : false ;
799815
800816 this . documents = [ ] ;
801817 }
@@ -816,12 +832,14 @@ export class BinMsg {
816832 const promoteLongs = options . promoteLongs ?? this . opts . promoteLongs ;
817833 const promoteValues = options . promoteValues ?? this . opts . promoteValues ;
818834 const promoteBuffers = options . promoteBuffers ?? this . opts . promoteBuffers ;
835+ const bsonRegExp = options . bsonRegExp ?? this . opts . bsonRegExp ;
819836
820837 // Set up the options
821838 const _options : BSONSerializeOptions = {
822- promoteLongs : promoteLongs ,
823- promoteValues : promoteValues ,
824- promoteBuffers : promoteBuffers
839+ promoteLongs,
840+ promoteValues,
841+ promoteBuffers,
842+ bsonRegExp
825843 } ;
826844
827845 while ( this . index < this . data . length ) {
0 commit comments