You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Pin the connection to the session so it get used to execute the command and we do not
59
-
// perform a double check-in/check-out.
60
-
session.pin(connection);
61
-
}else{
62
-
connection=session.pinnedConnection;
63
-
}
64
-
command=this.commandBuilder.buildBatch(
65
-
connection.hello?.maxMessageSizeBytes,
66
-
connection.hello?.maxWriteBatchSize,
67
-
connection.hello?.maxBsonObjectSize
68
-
);
69
-
}else{
70
-
thrownewMongoClientBulkWriteExecutionError(
71
-
'Session provided to the client bulk write operation must be present.'
72
-
);
73
-
}
74
-
}else{
75
-
// At this point we have a server and the auto connect code has already
76
-
// run in executeOperation, so the server description will be populated.
77
-
// We can use that to build the command.
78
-
if(
79
-
!server.description.maxWriteBatchSize||
80
-
!server.description.maxMessageSizeBytes||
81
-
!server.description.maxBsonObjectSize
82
-
){
83
-
thrownewMongoClientBulkWriteExecutionError(
84
-
'In order to execute a client bulk write, both maxWriteBatchSize, maxMessageSizeBytes and maxBsonObjectSize must be provided by the servers hello response.'
85
-
);
86
-
}
87
-
command=this.commandBuilder.buildBatch(
88
-
server.description.maxMessageSizeBytes,
89
-
server.description.maxWriteBatchSize,
90
-
server.description.maxBsonObjectSize
91
-
);
92
-
}
45
+
overridebuildCommandDocument(
46
+
connection: Connection,
47
+
_session?: ClientSession
48
+
): ClientBulkWriteCommand{
49
+
constcommand=this.commandBuilder.buildBatch(
50
+
connection.description.maxMessageSizeBytes,
51
+
connection.description.maxWriteBatchSize,
52
+
connection.description.maxBsonObjectSize
53
+
);
93
54
94
-
// Check after the batch is built if we cannot retry it and override the option.
55
+
// Check _after_ the batch is built if we cannot retry it and override the option.
0 commit comments