2 / 3
Aug 2024

Hi,

I am writing google tests on the code using mongocxx 3.6.1. I want to create a cursor for test purpose following the example (mongo-cxx-driver/examples/mongocxx/tailable_cursor.cpp at master · mongodb/mongo-cxx-driver · GitHub). As the default uri is localhost:27017, I get the exception when calling cursor.begin():
No suitable servers found (serverSelectionTryOnce set): [connection refused calling ismaster on ‘localhost:27017’]: generic server error"

Is there a way to set up the cursor not trying to connect to any server and just let cursor.begin() complete without exception?

Thanks.