MongoDB (two) c client

windows compile mongo-c-driver

After mongo-c-driver github address of a download release version 1.82, and found no project file vs, there are CMake file CMake now generally used to generate a platform makefile or project file, c client Zookeeper also CMake Form. It is simply solve the problem of cross-platform c compiler, the official website of the introduction to CMake:

CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.

Mongodb rely bson library, download a library, version 1.8.2 from https://github.com/mongodb/libbson/releases, before compiling Mongodb c of the driver you need to compile this libbson.

Downloaded from the official website, address download . Direct download binary packages like, download it, do not install green, bin folder has cmake-gui.exe file.

Compile bson library, vs2005 start using a bunch of questions, replaced vs2013, bson was compiled successfully, there is a compiler option addresses only know that linux is gcc and g ++, on windows is what turns a little Mongolian, enter under vs vc directory, probably read, a man named "cl.exe", cl, compile? Sure enough, you can try the next. Bson finished compiling the library, there are three files bson-1.0.lib, bson-static-1.0.lib, libbson-1.0.dll under Release. Then there is a project in the INSTALL project, compile and run down, it will generate a complete bson library, there are bin, include, lib three folders, this time bson compiled.

Compile mongo, with a lot of problems, but follow the prompts on CMake, select the path on it. INATALL still generate three files lib, bin, include. example-client run under the project, can read the data on the ok.

Implement bulk insert operation

The official website of the bulk insert instructions part the Operations Bulk the Write . When performing bulk insert may or may not be performed in the order according to the order concurrently, if no special requirements, not in order, efficiency is generally higher than according to the order. If the insertion efficiency is very high, the data is not so important, there is a "Unacknowledged Bulk Writes" do not need to confirm the insertion.

Routine follows: mongoc_collection_create_bulk_operation ();

reference

Use Cmake the windows and VC 2013 installation mongodb C driver

Original: Big Box  MongoDB (two) c client


Guess you like

Origin www.cnblogs.com/chinatrump/p/11607027.html