Skip to content

Commit 320dde0

Browse files
authored
fix(NODE-6259): replace dynamically assigned length property with a static getter (#4173)
1 parent de253a7 commit 320dde0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/bulk/common.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,10 @@ export abstract class BulkOperationBase {
11781178
);
11791179
}
11801180

1181+
get length(): number {
1182+
return this.s.currentIndex;
1183+
}
1184+
11811185
get bsonOptions(): BSONSerializeOptions {
11821186
return this.s.bsonOptions;
11831187
}
@@ -1274,13 +1278,6 @@ export abstract class BulkOperationBase {
12741278
}
12751279
}
12761280

1277-
Object.defineProperty(BulkOperationBase.prototype, 'length', {
1278-
enumerable: true,
1279-
get() {
1280-
return this.s.currentIndex;
1281-
}
1282-
});
1283-
12841281
function isInsertBatch(batch: Batch): boolean {
12851282
return batch.batchType === BatchType.INSERT;
12861283
}

0 commit comments

Comments
 (0)