Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,11 @@ ClientBulkWriteResult build(@Nullable final MongoException topLevelError, final
for (BsonDocument individualOperationResponse : response.getCursorExhaust()) {
int individualOperationIndexInBatch = individualOperationResponse.getInt32("idx").getValue();
int writeModelIndex = batchStartModelIndex + individualOperationIndexInBatch;
if (individualOperationResponse.getNumber("ok").intValue() == 1) {
assertTrue(verboseResultsSetting);
if (individualOperationResponse.getNumber("ok").intValue() == 1 && verboseResultsSetting) {
// Note: Previously, assertTrue(verboseResultsSetting) was used here because the server was not supposed
// to return successful operation results in the cursor when verboseResultsSetting is false.
// Due to server bug SERVER-113344, these unexpected results must be ignored until we stop supporting server
// versions with this bug. When that happens, restore assertTrue(verboseResultsSetting) here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave a TODO-<JAVA ticket ID> tag here, and create a corresponding ticket, which is linked as "blocked by" / "depends on" (not sure what relations we have) to the aforementioned server ticket.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may have to keep this code for some time (years) - while we wait for servers to be updated.

Copy link
Member Author

@vbabanin vbabanin Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a TODO-JAVA-6002 tag and created a follow-up ticket to restore the assertion.

I linked it to the server ticket as blocked by. As @rozza mentioned, even after the server fix lands it may not be backported to 8.x, so we’ll likely re-enable the assertion once our minimum supported server version includes the fix (or gate it conditionally on server version).

AbstractClientNamespacedWriteModel writeModel = getNamespacedModel(models, writeModelIndex);
if (writeModel instanceof ConcreteClientNamespacedInsertOneModel) {
insertResults.put(
Expand Down