[CDRIVER-2907] Add an example for how to implement cursor.hasNext functionality Created: 21/Dec/18  Updated: 02/Oct/23

Status: Backlog
Project: C Driver
Component/s: Docs Examples, libmongoc
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: Kevin Albertson Assignee: Adrian Dole
Resolution: Unresolved Votes: 0
Labels: neweng, newgrad
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Quarter: FY24Q3

 Description   

As discussed in mongodb-user: https://groups.google.com/forum/#!topic/mongodb-user/a0gbKkSLvxU

There isn't a great way to check if a cursor has another document to be iterated. mongoc_cursor_more isn't sufficient, since it doesn't actually contact the server, and returns true if the cursor is still open or has not yet been primed.

Let's formalize the workaround offered on the user group thread and make an official example for this in our documentation.


Generated at Wed Feb 07 21:16:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.