66 type AnyClientBulkWriteModel ,
77 type ClientSession ,
88 type Collection ,
9+ type Document ,
910 MongoBulkWriteError ,
1011 type MongoClient ,
1112 MongoClientBulkWriteError ,
@@ -175,7 +176,7 @@ describe('CRUD Prose Spec Tests', () => {
175176 // firstEvent.operationId is equal to secondEvent.operationId.
176177 let client : MongoClient ;
177178 let maxWriteBatchSize ;
178- const models : AnyClientBulkWriteModel [ ] = [ ] ;
179+ let models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
179180 const commands : CommandStartedEvent [ ] = [ ] ;
180181
181182 beforeEach ( async function ( ) {
@@ -188,12 +189,12 @@ describe('CRUD Prose Spec Tests', () => {
188189 client . on ( 'commandStarted' , filterForCommands ( 'bulkWrite' , commands ) ) ;
189190 commands . length = 0 ;
190191
191- Array . from ( { length : maxWriteBatchSize + 1 } , ( ) => {
192- models . push ( {
192+ models = Array . from ( { length : maxWriteBatchSize + 1 } , ( ) => {
193+ return {
193194 namespace : 'db.coll' ,
194195 name : 'insertOne' ,
195196 document : { a : 'b' }
196- } ) ;
197+ } ;
197198 } ) ;
198199 } ) ;
199200
@@ -243,7 +244,7 @@ describe('CRUD Prose Spec Tests', () => {
243244 let maxBsonObjectSize ;
244245 let maxMessageSizeBytes ;
245246 let numModels ;
246- const models : AnyClientBulkWriteModel [ ] = [ ] ;
247+ let models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
247248 const commands : CommandStartedEvent [ ] = [ ] ;
248249
249250 beforeEach ( async function ( ) {
@@ -258,14 +259,14 @@ describe('CRUD Prose Spec Tests', () => {
258259 client . on ( 'commandStarted' , filterForCommands ( 'bulkWrite' , commands ) ) ;
259260 commands . length = 0 ;
260261
261- Array . from ( { length : numModels } , ( ) => {
262- models . push ( {
262+ models = Array . from ( { length : numModels } , ( ) => {
263+ return {
263264 name : 'insertOne' ,
264265 namespace : 'db.coll' ,
265266 document : {
266267 a : 'b' . repeat ( maxBsonObjectSize - 500 )
267268 }
268- } ) ;
269+ } ;
269270 } ) ;
270271 } ) ;
271272
@@ -314,7 +315,7 @@ describe('CRUD Prose Spec Tests', () => {
314315 // Assert that two CommandStartedEvents were observed for the bulkWrite command.
315316 let client : MongoClient ;
316317 let maxWriteBatchSize ;
317- const models : AnyClientBulkWriteModel [ ] = [ ] ;
318+ let models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
318319 const commands : CommandStartedEvent [ ] = [ ] ;
319320
320321 beforeEach ( async function ( ) {
@@ -338,12 +339,12 @@ describe('CRUD Prose Spec Tests', () => {
338339 client . on ( 'commandStarted' , filterForCommands ( 'bulkWrite' , commands ) ) ;
339340 commands . length = 0 ;
340341
341- Array . from ( { length : maxWriteBatchSize + 1 } , ( ) => {
342- models . push ( {
342+ models = Array . from ( { length : maxWriteBatchSize + 1 } , ( ) => {
343+ return {
343344 namespace : 'db.coll' ,
344345 name : 'insertOne' ,
345346 document : { a : 'b' }
346- } ) ;
347+ } ;
347348 } ) ;
348349 } ) ;
349350
@@ -382,7 +383,7 @@ describe('CRUD Prose Spec Tests', () => {
382383 // Construct a list of write models (referred to as models) with model repeated maxWriteBatchSize + 1 times.
383384 let client : MongoClient ;
384385 let maxWriteBatchSize ;
385- const models : AnyClientBulkWriteModel [ ] = [ ] ;
386+ let models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
386387 const commands : CommandStartedEvent [ ] = [ ] ;
387388
388389 beforeEach ( async function ( ) {
@@ -396,12 +397,12 @@ describe('CRUD Prose Spec Tests', () => {
396397 client . on ( 'commandStarted' , filterForCommands ( 'bulkWrite' , commands ) ) ;
397398 commands . length = 0 ;
398399
399- Array . from ( { length : maxWriteBatchSize + 1 } , ( ) => {
400- models . push ( {
400+ models = Array . from ( { length : maxWriteBatchSize + 1 } , ( ) => {
401+ return {
401402 namespace : 'db.coll' ,
402403 name : 'insertOne' ,
403404 document : { _id : 1 }
404- } ) ;
405+ } ;
405406 } ) ;
406407 } ) ;
407408
@@ -471,7 +472,7 @@ describe('CRUD Prose Spec Tests', () => {
471472 // Assert that a CommandStartedEvent was observed for the getMore command.
472473 let client : MongoClient ;
473474 let maxBsonObjectSize ;
474- const models : AnyClientBulkWriteModel [ ] = [ ] ;
475+ const models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
475476 const commands : CommandStartedEvent [ ] = [ ] ;
476477
477478 beforeEach ( async function ( ) {
@@ -545,7 +546,7 @@ describe('CRUD Prose Spec Tests', () => {
545546 let client : MongoClient ;
546547 let session : ClientSession ;
547548 let maxBsonObjectSize ;
548- const models : AnyClientBulkWriteModel [ ] = [ ] ;
549+ const models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
549550 const commands : CommandStartedEvent [ ] = [ ] ;
550551
551552 beforeEach ( async function ( ) {
@@ -632,7 +633,7 @@ describe('CRUD Prose Spec Tests', () => {
632633 // Assert that a CommandStartedEvent was observed for the killCursors command.
633634 let client : MongoClient ;
634635 let maxBsonObjectSize ;
635- const models : AnyClientBulkWriteModel [ ] = [ ] ;
636+ const models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
636637 const getMoreCommands : CommandStartedEvent [ ] = [ ] ;
637638 const killCursorsCommands : CommandStartedEvent [ ] = [ ] ;
638639
@@ -803,7 +804,7 @@ describe('CRUD Prose Spec Tests', () => {
803804 let opsBytes ;
804805 let numModels ;
805806 let remainderBytes ;
806- let models : AnyClientBulkWriteModel [ ] = [ ] ;
807+ let models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
807808 const commands : CommandStartedEvent [ ] = [ ] ;
808809
809810 beforeEach ( async function ( ) {
@@ -821,12 +822,12 @@ describe('CRUD Prose Spec Tests', () => {
821822 commands . length = 0 ;
822823 models = [ ] ;
823824
824- Array . from ( { length : numModels } , ( ) => {
825- models . push ( {
825+ models = Array . from ( { length : numModels } , ( ) => {
826+ return {
826827 namespace : 'db.coll' ,
827828 name : 'insertOne' ,
828829 document : { a : 'b' . repeat ( maxBsonObjectSize - 57 ) }
829- } ) ;
830+ } ;
830831 } ) ;
831832
832833 if ( remainderBytes >= 217 ) {
@@ -859,7 +860,7 @@ describe('CRUD Prose Spec Tests', () => {
859860 it ( 'executes in a single batch' , {
860861 metadata : { requires : { mongodb : '>=8.0.0' , serverless : 'forbid' } } ,
861862 async test ( ) {
862- const sameNamespaceModel : AnyClientBulkWriteModel = {
863+ const sameNamespaceModel : AnyClientBulkWriteModel < Document > = {
863864 name : 'insertOne' ,
864865 namespace : 'db.coll' ,
865866 document : { a : 'b' }
@@ -896,7 +897,7 @@ describe('CRUD Prose Spec Tests', () => {
896897 metadata : { requires : { mongodb : '>=8.0.0' , serverless : 'forbid' } } ,
897898 async test ( ) {
898899 const namespace = `db.${ 'c' . repeat ( 200 ) } ` ;
899- const newNamespaceModel : AnyClientBulkWriteModel = {
900+ const newNamespaceModel : AnyClientBulkWriteModel < Document > = {
900901 name : 'insertOne' ,
901902 namespace : namespace ,
902903 document : { a : 'b' }
@@ -950,7 +951,7 @@ describe('CRUD Prose Spec Tests', () => {
950951 it ( 'raises a client error' , {
951952 metadata : { requires : { mongodb : '>=8.0.0' , serverless : 'forbid' } } ,
952953 async test ( ) {
953- const model : AnyClientBulkWriteModel = {
954+ const model : AnyClientBulkWriteModel < Document > = {
954955 name : 'insertOne' ,
955956 namespace : 'db.coll' ,
956957 document : { a : 'b' . repeat ( maxMessageSizeBytes ) }
@@ -976,7 +977,7 @@ describe('CRUD Prose Spec Tests', () => {
976977 metadata : { requires : { mongodb : '>=8.0.0' , serverless : 'forbid' } } ,
977978 async test ( ) {
978979 const namespace = `db.${ 'c' . repeat ( maxMessageSizeBytes ) } ` ;
979- const model : AnyClientBulkWriteModel = {
980+ const model : AnyClientBulkWriteModel < Document > = {
980981 name : 'insertOne' ,
981982 namespace : namespace ,
982983 document : { a : 'b' }
@@ -1033,7 +1034,7 @@ describe('CRUD Prose Spec Tests', () => {
10331034 } ) ;
10341035
10351036 it ( 'raises a client side error' , async function ( ) {
1036- const model : AnyClientBulkWriteModel = {
1037+ const model : AnyClientBulkWriteModel < Document > = {
10371038 name : 'insertOne' ,
10381039 namespace : 'db.coll' ,
10391040 document : { a : 'b' }
@@ -1113,7 +1114,7 @@ describe('CRUD Prose Spec Tests', () => {
11131114 let maxBsonObjectSize ;
11141115 let maxMessageSizeBytes ;
11151116 let numModels ;
1116- let models : AnyClientBulkWriteModel [ ] = [ ] ;
1117+ let models : AnyClientBulkWriteModel < Document > [ ] = [ ] ;
11171118 const commands : CommandStartedEvent [ ] = [ ] ;
11181119
11191120 beforeEach ( async function ( ) {
0 commit comments