Skip to content

Commit cb38894

Browse files
committed
wip
1 parent b3351ae commit cb38894

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cmap/connection.ts

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

0 commit comments

Comments
 (0)