mongo-c-driver
mongo-c-driver copied to clipboard
Add mongoc_cursor_get_batch_num
Thank you for the PR @Roman-Koshelev. Can you describe the use case for mongoc_cursor_get_batch_num? There may be other ways to solve the problem (e.g. command monitoring can be used to get information about commands sent to the server).
Usage example https://github.com/userver-framework/userver/blob/develop/mongo/src/storages/mongo/cdriver/cursor_impl.cpp#L68 . If there is a more elegant solution then I'm happy to use it
Thank you for sharing the use case. IIUC, this PR is intended help answer "Did mongoc_cursor_next contact the server?" to get the duration of a command sent to the server. I expect this may be possible to do with existing command monitoring events for. Here is an example (can be extended to listen for command failed).
Did it in https://github.com/userver-framework/userver/commit/9860015811e6139991709579cb881b207f896764