Skip to content

Commit 7acafe0

Browse files
LinusUbaileympearson
authored andcommitted
Fix invalid error message on hint with unacknowledged write
1 parent 7c8ff33 commit 7acafe0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/operations/update.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,16 @@ export class UpdateOperation extends CommandOperation<Document> {
110110
const unacknowledgedWrite = this.writeConcern && this.writeConcern.w === 0;
111111
if (unacknowledgedWrite) {
112112
if (this.statements.find((o: Document) => o.hint)) {
113-
callback(new MongoCompatibilityError(`Servers < 3.4 do not support hint on update`));
113+
if (maxWireVersion(server) < 5) {
114+
callback(new MongoCompatibilityError(`Servers < 3.4 do not support hint on update`));
115+
} else {
116+
// TODO: https://jira.mongodb.org/browse/NODE-3541
117+
callback(
118+
new MongoCompatibilityError(
119+
`This Node.js driver do not support hint together with unacknowledged writes`
120+
)
121+
);
122+
}
114123
return;
115124
}
116125
}

0 commit comments

Comments
 (0)