Skip to content

Commit

Permalink
chore: misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Sep 26, 2022
1 parent 0c3fd9d commit e9de925
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/operations/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export class DeleteOperation extends CommandOperation<Document> {
const unacknowledgedWrite = this.writeConcern && this.writeConcern.w === 0;
if (unacknowledgedWrite || maxWireVersion(server) < 5) {
if (this.statements.find((o: Document) => o.hint)) {
callback(new MongoCompatibilityError(`Servers < 3.4 do not support hint on delete`));
// TODO(NODE-3541): fix error for hint with unacknowledged writes
callback(new MongoCompatibilityError(`hint is not supported with unacknowledged writes`));
return;
}
}
Expand Down
12 changes: 2 additions & 10 deletions src/operations/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,8 @@ export class UpdateOperation extends CommandOperation<Document> {
const unacknowledgedWrite = this.writeConcern && this.writeConcern.w === 0;
if (unacknowledgedWrite || maxWireVersion(server) < 5) {
if (this.statements.find((o: Document) => o.hint)) {
if (maxWireVersion(server) < 5) {
callback(new MongoCompatibilityError(`Servers < 3.4 do not support hint on update`));
} else {
// TODO: https://jira.mongodb.org/browse/NODE-3541
callback(
new MongoCompatibilityError(
`This Node.js driver do not support hint together with unacknowledged writes`
)
);
}
// TODO(NODE-3541): fix error for hint with unacknowledged writes
callback(new MongoCompatibilityError(`hint is not supported with unacknowledged writes`));
return;
}
}
Expand Down

0 comments on commit e9de925

Please sign in to comment.