Skip to content

Commit d7f1a00

Browse files
taplinMike Pollardclaude
committed
Fix update(updates:) reporting success as failure off server ID 1
mongoc_bulk_operation_execute returns the ID of the server that ran the write, or 0 on failure. update(updates:) compared the result to 1, so a successful bulk update reported an error whenever the server's ID wasn't 1, as is common on replica sets and Atlas. Check for non-zero, as insert(documents:) already does. Originally reported and fixed in #28. Co-Authored-By: Mike Pollard <mike.pollard@clubspark.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7008bc5 commit d7f1a00

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Sources/PerfectMongoDB/MongoCollection.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public class MongoCollection {
396396
return Result.fromError(error)
397397
}
398398
}
399-
guard mongoc_bulk_operation_execute(bulk, toOpaque(&reply), &error) == 1 else {
399+
guard mongoc_bulk_operation_execute(bulk, toOpaque(&reply), &error) != 0 else {
400400
return Result.fromError(error)
401401
}
402402
return .success

0 commit comments

Comments
 (0)