Skip to content

Commit 8e3de2c

Browse files
bjorihanumantmk
authored andcommitted
CDRIVER-466: Add mongoc_cursor_get_id()
These can be retrieved by calling currentOp, but its impossible to map them to specific cursor. We can just as well expose the id rather then having the user guessing Closes #122
1 parent 6dbd8d8 commit 8e3de2c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/mongoc/mongoc-cursor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,3 +1055,10 @@ mongoc_cursor_get_hint (const mongoc_cursor_t *cursor)
10551055
return cursor->hint;
10561056
}
10571057

1058+
uint64_t
1059+
mongoc_cursor_get_id (const mongoc_cursor_t *cursor)
1060+
{
1061+
BSON_ASSERT(cursor);
1062+
1063+
return cursor->rpc.reply.cursor_id;
1064+
}

src/mongoc/mongoc-cursor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ void mongoc_cursor_set_batch_size (mongoc_cursor_t *cursor,
4747
uint32_t batch_size);
4848
uint32_t mongoc_cursor_get_batch_size (const mongoc_cursor_t *cursor);
4949
uint32_t mongoc_cursor_get_hint (const mongoc_cursor_t *cursor);
50+
uint64_t mongoc_cursor_get_id (const mongoc_cursor_t *cursor);
5051

5152

5253
BSON_END_DECLS

0 commit comments

Comments
 (0)