#include <exception>
#include <iostream>
#include <mongo/client/dbclient.h>

using namespace std;

int main() {
  mongo::DBClientConnection* connection = new mongo::DBClientConnection;
  try {
    connection->connect("localhost:27017");
  }
  catch (mongo::UserException& e) {
    cout << "mongo::UserException: " << e.what() << endl;
  }
  catch (std::exception& e) {
    cout << "std::exception: " << e.what() << endl;
  }
  delete connection;
  return 0;
}
