Alternatives to mongocxx?

Are there any alterntaive drivers to mongocxx , for windows os based c++ applications .

Hi @Tharindu_Balasooriya,

Are you looking for an alternative driver because of installation issues, or do you have other requirements?

I appreciate you have been having some difficulties getting your environment set up, but we’ll need some more details to help you in discussions like The C compiler identification is unknown ? MongoDB c - windows 10.

mongocxx is the officially supported cross-platform C++ driver and I’m not aware of any actively developed alternatives. An important aspect of official drivers is that they implement MongoDB specifications for consistent behaviour. If you are looking for a different API, there are often abstractions like Object-Document Mappers (ODMs) that build on the official driver.

Regards,
Stennie

Yes, I’m struggling with install mongocxx on windows. I have some errors that I previously had, but still I am getting so many errors.
Here is the error that I’m struggling now

    LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1428~1.299\bin\Hostx86\x86\link.exe /nologo @CMakeFiles\untitled5.dir\objects1.rsp /out:untitled5.exe /implib:untitled5.lib /pdb:C:\Users\Tharindu\CLionProjects\untitled5\cmake-build-debug\untitled5.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\untitled5.dir/intermediate.manifest CMakeFiles\untitled5.dir/manifest.res" failed (exit code 1120) with the following output:
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall bsoncxx::v_noabi::string::view_or_value::view_or_value(char const *)" (__imp_??0view_or_value@string@v_noabi@bsoncxx@@QAE@PBD@Z) referenced in function _main
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongocxx::v_noabi::options::client::client(void)" (__imp_??0client@options@v_noabi@mongocxx@@QAE@XZ) referenced in function _main
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongocxx::v_noabi::options::client::~client(void)" (__imp_??1client@options@v_noabi@mongocxx@@QAE@XZ) referenced in function _main
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongocxx::v_noabi::uri::uri(class bsoncxx::v_noabi::string::view_or_value)" (__imp_??0uri@v_noabi@mongocxx@@QAE@Vview_or_value@string@1bsoncxx@@@Z) referenced in function _main
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongocxx::v_noabi::uri::~uri(void)" (__imp_??1uri@v_noabi@mongocxx@@QAE@XZ) referenced in function _main
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongocxx::v_noabi::client::client(class mongocxx::v_noabi::uri const &,class mongocxx::v_noabi::options::client const &)" (__imp_??0client@v_noabi@mongocxx@@QAE@ABVuri@12@ABV0options@12@@Z) referenced in function _main
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongocxx::v_noabi::client::~client(void)" (__imp_??1client@v_noabi@mongocxx@@QAE@XZ) referenced in function _main
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongocxx::v_noabi::instance::instance(void)" (__imp_??0instance@v_noabi@mongocxx@@QAE@XZ) referenced in function _main
    main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongocxx::v_noabi::instance::~instance(void)" (__imp_??1instance@v_noabi@mongocxx@@QAE@XZ) referenced in function _main
    untitled5.exe : fatal error LNK1120: 9 unresolved externals
    NMAKE : fatal error U1077: '"C:\Program Files\JetBrains\CLion 2020.3.3\bin\cmake\win\bin\cmake.exe"' : return code '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
    Stop.

Can you help me on this ?

HI @Tharindu_Balasooriya,

Including this discussion, you have currently have four active topics which all seem related to your install issues.

It will be easier for someone to help if you can keep discussion for the same problem focused in a single topic. If you’ve solved an issue and moved on to a new problem and new topic, it would also be helpful to reply to the original topic with your solution (or choose one of the existing posts as a solution as a signal further help is not required).

I believe the problem you’ve quoted here is the same as Mongo cxx driver issue - undefined reference to `__imp__ZN7bsoncxx7v_, so it would be best not to fork that discussion. I would also keep this topic focused on your question of alternative C++ drivers for Windows.

Your issues appear to be with setting up your build environment, but if you want a comparison point (and are open to using Docker), you may find @wan’s Get Started project helpful: "Get Started" with MongoDB Atlas.

The get-started-cxx repo sets up a working Linux development environment with some sample C++ code. You can set the MONGO_URI to any valid MongoDB connection string URI (Atlas, self-hosted, or locally hosted). However, since your end goal appears to be building Windows C++ apps using MinGW64 this may not be a productive direction to explore.

Regards,
Stennie