Hello David,
I do not want to have one connection object, but one per mongo instance.
The fact is that in order to use both authentication and ScopedDbConnection (i really need a pool since multithreaded app), i need to add a hook in pool global variable that will make the authentication.
There is no way in the hook to determine from which host the onCreate method is call for.
What I would like is to be able to switch on the mongo host directly in the hook
Here is an example of how i use db connection :
on init :
DbAuthHook *dbhook = new DbAuthHook();
pool.addHookd(dbhook);
when request to db is needed :
ScopedDbConnection logconn(logcstring);
logconn->insert(log_collection, BSON("test" << "log"));
ScopedDbConnection dbconn(dbcstring);
dbconn->insert(data_collection, BSON("data" << "new_data"));
I hope it is a little bit more clearer,
Thomas.