Reputation: 31
If my DB stores lots of documents, and the find() will only return a batch size of documents, how can I use mongocxx::cursor to move to next batch? I didn't find any examples, can someone give me some suggestions or should I switch to mongoc driver?
Upvotes: 1
Views: 506
Reputation: 12727
The cursor will continue to fetch batches as you advance it. You don't need to do anything special.
Please see/run this example:
https://github.com/mongodb/mongo-cxx-driver/blob/releases/stable/examples/mongocxx/query.cpp#L38-L46
Upvotes: 1