GiGImushroom
GiGImushroom

Reputation: 31

how to make mongocxx cursor return batch results

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

Answers (1)

acm
acm

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

Related Questions