File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
src/operations/client_bulk_write Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ export class ClientBulkWriteOperation extends CommandOperation<ClientBulkWriteCu
3131 return this . commandBuilder . resetBatch ( ) ;
3232 }
3333
34+ override get canRetryWrite ( ) : boolean {
35+ return this . commandBuilder . isRetryable && super . canRetryWrite ;
36+ }
37+
3438 /**
3539 * Execute the command. Superclass will handle write concern, etc.
3640 * @param server - The server.
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ export class ClientBulkWriteCommandBuilder {
4242 currentModelIndex : number ;
4343 previousModelIndex : number ;
4444 lastOperations : Document [ ] ;
45+ isRetryable : boolean ;
4546
4647 /**
4748 * Create the command builder.
@@ -58,6 +59,10 @@ export class ClientBulkWriteCommandBuilder {
5859 this . currentModelIndex = 0 ;
5960 this . previousModelIndex = 0 ;
6061 this . lastOperations = [ ] ;
62+ // Multi updates are not retryable.
63+ this . isRetryable = ! models . some ( model => {
64+ return model . name === 'deleteMany' || model . name === 'updateMany' ;
65+ } ) ;
6166 }
6267
6368 /**
Original file line number Diff line number Diff line change @@ -70,7 +70,6 @@ export class ClientBulkWriteResultsMerger {
7070 // record the error in writeErrors and immediately throw the exception. Otherwise, drivers
7171 // MUST continue to iterate the results cursor and execute any further bulkWrite batches.
7272 if ( this . options . ordered ) {
73- console . log ( document ) ;
7473 const error = new MongoClientBulkWriteError ( {
7574 message : 'Mongo client ordered bulk write encountered a write error.'
7675 } ) ;
You can’t perform that action at this time.
0 commit comments