Based on the configure mongocxx driver page I modified the Uri to read “mongodb://localhost:27017/&user:userpwd/&authSource=admin” .
Hi,
Are you referring to mongo-cxx-driver: configuration page ?
The username and password should go before the hosts value, for example:
auto client = mongocxx::client{uri{"mongodb://username:password@localhost:27017/?authSource=databaseName"}};
Which follows the format of MongoDB Connection String URI.
mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
If you still have futher questions, could you provide:
mongocxx version mongocxx::uriRegards,
Wan.