@@ -304,6 +304,7 @@ export class Response {
304304 queryFailure ?: boolean ;
305305 shardConfigStale ?: boolean ;
306306 awaitCapable ?: boolean ;
307+ useBigInt64 : boolean ;
307308 promoteLongs : boolean ;
308309 promoteValues : boolean ;
309310 promoteBuffers : boolean ;
@@ -320,6 +321,7 @@ export class Response {
320321 this . raw = message ;
321322 this . data = msgBody ;
322323 this . opts = opts ?? {
324+ useBigInt64 : false ,
323325 promoteLongs : true ,
324326 promoteValues : true ,
325327 promoteBuffers : false ,
@@ -334,6 +336,7 @@ export class Response {
334336 this . fromCompressed = msgHeader . fromCompressed ;
335337
336338 // Flag values
339+ this . useBigInt64 = typeof this . opts . useBigInt64 === 'boolean' ? this . opts . useBigInt64 : false ;
337340 this . promoteLongs = typeof this . opts . promoteLongs === 'boolean' ? this . opts . promoteLongs : true ;
338341 this . promoteValues =
339342 typeof this . opts . promoteValues === 'boolean' ? this . opts . promoteValues : true ;
@@ -354,6 +357,7 @@ export class Response {
354357 // Allow the return of raw documents instead of parsing
355358 const raw = options . raw || false ;
356359 const documentsReturnedIn = options . documentsReturnedIn || null ;
360+ const useBigInt64 = options . useBigInt64 ?? this . opts . useBigInt64 ;
357361 const promoteLongs = options . promoteLongs ?? this . opts . promoteLongs ;
358362 const promoteValues = options . promoteValues ?? this . opts . promoteValues ;
359363 const promoteBuffers = options . promoteBuffers ?? this . opts . promoteBuffers ;
@@ -362,6 +366,7 @@ export class Response {
362366
363367 // Set up the options
364368 const _options : BSONSerializeOptions = {
369+ useBigInt64,
365370 promoteLongs,
366371 promoteValues,
367372 promoteBuffers,
@@ -590,6 +595,7 @@ export class BinMsg {
590595 checksumPresent : boolean ;
591596 moreToCome : boolean ;
592597 exhaustAllowed : boolean ;
598+ useBigInt64 : boolean ;
593599 promoteLongs : boolean ;
594600 promoteValues : boolean ;
595601 promoteBuffers : boolean ;
@@ -607,6 +613,7 @@ export class BinMsg {
607613 this . raw = message ;
608614 this . data = msgBody ;
609615 this . opts = opts ?? {
616+ useBigInt64 : false ,
610617 promoteLongs : true ,
611618 promoteValues : true ,
612619 promoteBuffers : false ,
@@ -625,6 +632,7 @@ export class BinMsg {
625632 this . checksumPresent = ( this . responseFlags & OPTS_CHECKSUM_PRESENT ) !== 0 ;
626633 this . moreToCome = ( this . responseFlags & OPTS_MORE_TO_COME ) !== 0 ;
627634 this . exhaustAllowed = ( this . responseFlags & OPTS_EXHAUST_ALLOWED ) !== 0 ;
635+ this . useBigInt64 = typeof this . opts . useBigInt64 === 'boolean' ? this . opts . useBigInt64 : false ;
628636 this . promoteLongs = typeof this . opts . promoteLongs === 'boolean' ? this . opts . promoteLongs : true ;
629637 this . promoteValues =
630638 typeof this . opts . promoteValues === 'boolean' ? this . opts . promoteValues : true ;
@@ -648,6 +656,7 @@ export class BinMsg {
648656 // Allow the return of raw documents instead of parsing
649657 const raw = options . raw || false ;
650658 const documentsReturnedIn = options . documentsReturnedIn || null ;
659+ const useBigInt64 = options . useBigInt64 ?? this . opts . useBigInt64 ;
651660 const promoteLongs = options . promoteLongs ?? this . opts . promoteLongs ;
652661 const promoteValues = options . promoteValues ?? this . opts . promoteValues ;
653662 const promoteBuffers = options . promoteBuffers ?? this . opts . promoteBuffers ;
@@ -656,6 +665,7 @@ export class BinMsg {
656665
657666 // Set up the options
658667 const bsonOptions : BSONSerializeOptions = {
668+ useBigInt64,
659669 promoteLongs,
660670 promoteValues,
661671 promoteBuffers,
0 commit comments