Skip to content

Commit a9afdeb

Browse files
authored
CDRIVER-3933 Reinit reply in estimatedDocumentCount for NamespaceNotFound (#766)
1 parent 6bacf92 commit a9afdeb

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/libmongoc/src/mongoc/mongoc-collection.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,9 @@ mongoc_collection_estimated_document_count (
909909
/* Collection does not exist. From spec: return 0 but no err:
910910
* https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#estimateddocumentcount
911911
*/
912+
if (reply) {
913+
bson_reinit (reply);
914+
}
912915
memset (error, 0, sizeof *error);
913916
count = 0;
914917
GOTO (done);

src/libmongoc/tests/unified/operation.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -817,12 +817,7 @@ operation_estimated_document_count (test_t *test,
817817
val = bson_val_from_int64 (op_ret);
818818
}
819819

820-
/* CDRIVER-3933 Remove special case for 0 count. */
821-
if (op_ret == 0) {
822-
result_from_val_and_reply (result, val, NULL, &op_error);
823-
} else {
824-
result_from_val_and_reply (result, val, &op_reply, &op_error);
825-
}
820+
result_from_val_and_reply (result, val, &op_reply, &op_error);
826821

827822
ret = true;
828823
done:

0 commit comments

Comments
 (0)