Building on Windows

When building the driver on Windows, you must use the Python build
utility, SCons. For your compiler, we recommend that you use Visual Studio.
If you don't have Visual Studio, a free version is available. Search for Visual
Studio C++ Express to find it.

If you're running on 32-bit Windows, you must compile the driver in 32-bit mode:

scons --m32

If getaddrinfo and friends aren't available on your version of Windows, you may
compile without these features like so:

scons --m32 --standard-env

Platform-specific features

The original goal of the MongoDB C driver was to provide a very basic library
capable of being embedded anywhere. This goal is now evolving somewhat given
the increased use of the driver. In particular, it now makes sense to provide
platform-specific features, such as socket timeouts and DNS resolution, and to
return platform-specific error codes.

To that end, we've organized all platform-specific code in the following files:

When building with make, we use env_posix.c. When building with SCons, we
use env_posix.c or env_win32.c, depending on the platform.

If you want to compile with the generic, platform implementation, you have to do so
explicity. In SCons:

scons --standard-env

Using make:

make ENV=standard

Dependencies

The driver itself has no dependencies, but one of the tests shows how to create a JSON-to-BSON
converter. For that test to run, you'll need JSON-C.

Test suite

Make sure that you're running mongod on 127.0.0.1 on the default port (27017). The replica set
test assumes a replica set with at least three nodes running at 127.0.0.1 and starting at port
30000. Note that the driver does not recognize 'localhost' as a valid host name.

With make:

make test

To compile and run the tests with SCons:

scons test

You may optionally specify a remote server:

scons test --test-server=123.4.5.67

You may also specify an alternate starting port for the replica set members: