How can I build a program using c++ driver of mongodb?

前端 未结 2 660
不知归路
不知归路 2020-12-04 00:15

Please tell me how to build a program using c++ driver of mongodb. No flames about my bad English.

My Environment

  • Windows7 64bit
  • Visual Studio
2条回答
  •  离开以前
    2020-12-04 01:07

    Simple solution use vcpkg.

    Download vcpkg follow the instructions as mentioned on git. https://github.com/Microsoft/vcpkg

    Step 1 C:\vcpkg>.\vcpkg search mongodb

    you will see something like that

    mongo-c-driver 1.6.2-1 Client library written in C for MongoDB.

    mongo-cxx-driver 3.1.1-1 MongoDB C++ Driver.

    Step 2 C:.\vcpkg search mongodb install mongo-cxx-driver

    then grab cup of coffee ....

    Stap 3

    C:\vcpkg>.\vcpkg integrate install

    Done..

    Note Prerequisites:

    Windows 10, 8.1, or 7

    Visual Studio 2017 or Visual Studio 2015 Update 3

    simply import

       #include 
       #include 
       #include 
       #include 
       #include 
       #include 
       #include 
    
         using bsoncxx::builder::stream::close_array;
         using bsoncxx::builder::stream::close_document;
         using bsoncxx::builder::stream::document;
         using bsoncxx::builder::stream::finalize;
         using bsoncxx::builder::stream::open_array;
         using bsoncxx::builder::stream::open_document;
    

提交回复
热议问题