From 320dde04aa1547dd838e7c790bb3432e2ca2bc19 Mon Sep 17 00:00:00 2001 From: Stanimira Vlaeva Date: Thu, 11 Jul 2024 22:22:50 +0300 Subject: [PATCH] fix(NODE-6259): replace dynamically assigned length property with a static getter (#4173) --- src/bulk/common.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/bulk/common.ts b/src/bulk/common.ts index 892952c3cf9..ad0451e9ac1 100644 --- a/src/bulk/common.ts +++ b/src/bulk/common.ts @@ -1178,6 +1178,10 @@ export abstract class BulkOperationBase { ); } + get length(): number { + return this.s.currentIndex; + } + get bsonOptions(): BSONSerializeOptions { return this.s.bsonOptions; } @@ -1274,13 +1278,6 @@ export abstract class BulkOperationBase { } } -Object.defineProperty(BulkOperationBase.prototype, 'length', { - enumerable: true, - get() { - return this.s.currentIndex; - } -}); - function isInsertBatch(batch: Batch): boolean { return batch.batchType === BatchType.INSERT; }