Skip to content

Commit bf1ca3f

Browse files
committed
wip
1 parent 44a86d3 commit bf1ca3f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cmap/connection.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,10 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
571571
): Promise<Document> {
572572
this.throwIfAborted();
573573
for await (const document of this.sendCommand(ns, command, options, responseType)) {
574-
if (document.has('writeConcernError')) {
574+
if (
575+
(MongoDBResponse.is(document) && document.has('writeConcernError')) ||
576+
(!MongoDBResponse.is(document) && document.writeConcernError)
577+
) {
575578
const object = MongoDBResponse.is(document) ? document.toObject(options) : document;
576579
throw new MongoWriteConcernError(object.writeConcernError, object);
577580
}

0 commit comments

Comments
 (0)