how to install/compile MongoDB C driver

  • download source code from here
  • extract it and compile
$ ./configure --help ;list all options
$ ./configure --disable-automatic-init-and-cleanup 
$ make
$ sudo make install ; or su to root, then make install
  • write a sample code and export PKG_CONFIG_PATH for pkg-config, then compile with gcc
$ gcc -o connect MongoDBTest.c $(pkg-config --cflags --libs libmongoc-1.0)

driver compatibility
https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/
example:
http://mongoc.org/libmongoc/current/tutorial.html#starting-mongodb