@@ -36,6 +36,8 @@ let PROCESS_UNIQUE: Uint8Array | null = null;
3636
3737/** ObjectId hexString cache @internal */
3838const __idCache = new WeakMap < ObjectId , string > ( ) ; // TODO(NODE-6549): convert this to #__id private field when target updated to ES2022
39+ const __pool = new WeakMap < ObjectId , Uint8Array > ( ) ; // TODO(NODE-6549): convert this to #pool private field when target updated to ES2022
40+ const __offset = new WeakMap < ObjectId , number > ( ) ; // TODO(NODE-6549): convert this to #offset private field when target updated to ES2022
3941
4042/** @public */
4143export interface ObjectIdLike {
@@ -76,12 +78,20 @@ export class ObjectId extends BSONValue {
7678 }
7779
7880 /** ObjectId buffer pool pointer @internal */
79- private pool : Uint8Array ;
80- /** Buffer pool offset @internal */
81- private offset ?: number ;
81+ private get pool ( ) : Uint8Array {
82+ return __pool . get ( this ) as Uint8Array ;
83+ }
84+ private set pool ( value : Uint8Array ) {
85+ __pool . set ( this , value ) ;
86+ }
8287
83- /** ObjectId hexString cache @internal */
84- private __id ?: string ;
88+ /** Buffer pool offset @internal */
89+ private get offset ( ) : number | undefined {
90+ return __offset . get ( this ) ;
91+ }
92+ private set offset ( value : number ) {
93+ __offset . set ( this , value ) ;
94+ }
8595
8696 /**
8797 * Create ObjectId from a number.
0 commit comments