@@ -491,6 +491,7 @@ export class Response {
491
491
promoteLongs : boolean ;
492
492
promoteValues : boolean ;
493
493
promoteBuffers : boolean ;
494
+ bsonRegExp ?: boolean ;
494
495
index ?: number ;
495
496
496
497
constructor (
@@ -502,7 +503,12 @@ export class Response {
502
503
this . parsed = false ;
503
504
this . raw = message ;
504
505
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
+ } ;
506
512
507
513
// Read the message header
508
514
this . length = msgHeader . length ;
@@ -530,6 +536,7 @@ export class Response {
530
536
typeof this . opts . promoteValues === 'boolean' ? this . opts . promoteValues : true ;
531
537
this . promoteBuffers =
532
538
typeof this . opts . promoteBuffers === 'boolean' ? this . opts . promoteBuffers : false ;
539
+ this . bsonRegExp = typeof this . opts . bsonRegExp === 'boolean' ? this . opts . bsonRegExp : false ;
533
540
}
534
541
535
542
isParsed ( ) : boolean {
@@ -547,13 +554,15 @@ export class Response {
547
554
const promoteLongs = options . promoteLongs ?? this . opts . promoteLongs ;
548
555
const promoteValues = options . promoteValues ?? this . opts . promoteValues ;
549
556
const promoteBuffers = options . promoteBuffers ?? this . opts . promoteBuffers ;
557
+ const bsonRegExp = options . bsonRegExp ?? this . opts . bsonRegExp ;
550
558
let bsonSize ;
551
559
552
560
// Set up the options
553
561
const _options : BSONSerializeOptions = {
554
- promoteLongs : promoteLongs ,
555
- promoteValues : promoteValues ,
556
- promoteBuffers : promoteBuffers
562
+ promoteLongs,
563
+ promoteValues,
564
+ promoteBuffers,
565
+ bsonRegExp
557
566
} ;
558
567
559
568
// Position within OP_REPLY at which documents start
@@ -765,6 +774,7 @@ export class BinMsg {
765
774
promoteLongs : boolean ;
766
775
promoteValues : boolean ;
767
776
promoteBuffers : boolean ;
777
+ bsonRegExp : boolean ;
768
778
documents : ( Document | Buffer ) [ ] ;
769
779
index ?: number ;
770
780
@@ -777,7 +787,12 @@ export class BinMsg {
777
787
this . parsed = false ;
778
788
this . raw = message ;
779
789
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
+ } ;
781
796
782
797
// Read the message header
783
798
this . length = msgHeader . length ;
@@ -796,6 +811,7 @@ export class BinMsg {
796
811
typeof this . opts . promoteValues === 'boolean' ? this . opts . promoteValues : true ;
797
812
this . promoteBuffers =
798
813
typeof this . opts . promoteBuffers === 'boolean' ? this . opts . promoteBuffers : false ;
814
+ this . bsonRegExp = typeof this . opts . bsonRegExp === 'boolean' ? this . opts . bsonRegExp : false ;
799
815
800
816
this . documents = [ ] ;
801
817
}
@@ -816,12 +832,14 @@ export class BinMsg {
816
832
const promoteLongs = options . promoteLongs ?? this . opts . promoteLongs ;
817
833
const promoteValues = options . promoteValues ?? this . opts . promoteValues ;
818
834
const promoteBuffers = options . promoteBuffers ?? this . opts . promoteBuffers ;
835
+ const bsonRegExp = options . bsonRegExp ?? this . opts . bsonRegExp ;
819
836
820
837
// Set up the options
821
838
const _options : BSONSerializeOptions = {
822
- promoteLongs : promoteLongs ,
823
- promoteValues : promoteValues ,
824
- promoteBuffers : promoteBuffers
839
+ promoteLongs,
840
+ promoteValues,
841
+ promoteBuffers,
842
+ bsonRegExp
825
843
} ;
826
844
827
845
while ( this . index < this . data . length ) {
0 commit comments