Skip to content

Commit 7eb29cc

Browse files
author
Christian Hergert
committed
cursor: allow command responses that do not have "ok" field.
1 parent 7cf514e commit 7eb29cc

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/mongoc/mongoc-cursor.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -454,14 +454,15 @@ _mongoc_cursor_unwrap_failure (mongoc_cursor_t *cursor)
454454
}
455455
RETURN(true);
456456
} else if (cursor->is_command) {
457-
if (_mongoc_rpc_reply_get_first(&cursor->rpc.reply, &b)) {
458-
if ( bson_iter_init_find(&iter, &b, "ok") &&
459-
bson_iter_as_bool(&iter)) {
460-
RETURN (false);
461-
} else {
462-
_mongoc_cursor_populate_error(cursor, &b, &cursor->error);
463-
bson_destroy(&b);
464-
RETURN (true);
457+
if (_mongoc_rpc_reply_get_first (&cursor->rpc.reply, &b)) {
458+
if (bson_iter_init_find (&iter, &b, "ok")) {
459+
if (bson_iter_as_bool (&iter)) {
460+
RETURN (false);
461+
} else {
462+
_mongoc_cursor_populate_error (cursor, &b, &cursor->error);
463+
bson_destroy (&b);
464+
RETURN (true);
465+
}
465466
}
466467
} else {
467468
bson_set_error (&cursor->error,

0 commit comments

Comments
 (0)