Mongo DB C++ Driver Issues - Part 1 of Many

After a long and arduous struggle to get the Mongo DB C++ driver to build on Windows, I connect to the database and receive a rude reply about "WSAStartup" not being called yet. My code looked exactly the same as the stuff on the website. What could be wrong?

try
{
        mongo::DBClientConnection client;
        client.connect(std::string("localhost"));
        // Do Something useful here!
}
catch (const mongo::DBException &e) {
        std::cout << "caught " << e.what() << std::endl;
}

The connect function throws an exception with the message "getnameinfo error errno:10093 Either the application has not called WSAStartup, or WSAStartup failed.". After digging around for a while I found out that you have to call the initialize function, which initializes WinSock. Who knew?

try
{
        mongo::client::initialize(true);
        mongo::DBClientConnection client;
        client.connect(std::string("localhost"));
        // Do Something useful here!
}
catch (const mongo::DBException &e) {
        std::cout << "caught " << e.what() << std::endl;
}

Now it works! Getting it to build on Windows with Visual Studio 2013 is a bit of a hacky adventure, but that's the topic for another day.