Skip to content

Commit

Permalink
cachedb_mongodb: treat case when counter is missing
Browse files Browse the repository at this point in the history
(cherry picked from commit dd1446b)
  • Loading branch information
razvancrainea committed Dec 18, 2020
1 parent fd0e4b7 commit b7eabf1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/cachedb_mongodb/cachedb_mongodb_dbase.c
Expand Up @@ -1023,7 +1023,7 @@ int mongo_con_get_counter(cachedb_con *con, str *attr, int *val)
mongoc_cursor_t *cursor;
bson_iter_t iter;
struct timeval start;
int ret = 0;
int ret = -2;

query = bson_new();
#if MONGOC_CHECK_VERSION(1, 5, 0)
Expand Down Expand Up @@ -1059,6 +1059,7 @@ int mongo_con_get_counter(cachedb_con *con, str *attr, int *val)
value = bson_iter_value(&iter);
switch (value->value_type) {
case BSON_TYPE_INT32:
ret = 0;
*val = value->value.v_int32;
break;
default:
Expand Down

0 comments on commit b7eabf1

Please sign in to comment.