linux - How to connect MongoDB with Qt c++ ? -


i trying connect mongodb qt c++. wrote simple application runs without error.

mainwindow::mainwindow(qwidget *parent) :     qmainwindow(parent),     ui(new ui::mainwindow) {     ui->setupui(this);      try     {         connectmongo();         qdebug() << "connection done";     }     catch (const mongo::dbexception &e)     {         qdebug() << "failed : " << e.what();     }  }  void mainwindow::connectmongo() {         mongo::dbclientconnection c;         c.connect("127.0.0.1"); } 

however, when type "127.0.0.1" or "localhost" cannot connect , in debug windows says:

the program has unexpectedly finished. 

when type value c.connect("0.0.0.0");

it goes in catch block , exception :

failed :  can't connect couldn't connect server 0.0.0.0:27017 

as far understand works correct port number, describing on mongodb api default. why cannot use mongodb , cannot connect it?

here output of service;

[mg@mg-centos ~]$ service mongod status mongod (pid 4151) running... 


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -