Fast writing to mongodb make Application not responding
-
Data reading fast in Qt creator , i used to sent this data to mongodb .
When i written db["Tag1"].update_one method it makes application not responding.
so then i tried builk write
it also makes haang to application…
how to solve thiscode part"
mongocxx::client& conn1 = get_client(); mongocxx::database db; db = conn1["ASSET_TRACKING"];
if (k != -1) { // qDebug() << "value found at "<<k ; qWarning("Got db conn"); switch(k) { case 0 : { std::vector<bsoncxx::document::value> documents; documents.push_back( bsoncxx::builder::stream::document{} <<"tag_ID"<< e.toStdString() <<"POSX"<<posx<<"POSY"<<posy<<"POSZ"<<posz<< finalize); db["Tagdemo"].insert_many(documents);
// if(posx<30 &&posy<30)
// {
// db["Tag1"].update_one(bsoncxx::builder::stream::document{} <<"bool"<< 1 << finalize,
// bsoncxx::builder::stream::document{} << "$set" << open_document <<
// "tag_ID"<< e.toStdString() <<"POSX"<<posx<<"POSY"<<posy<<"POSZ"<<posz << close_document << finalize);
//
// }
} -
@Vivek_A said in Fast writing to mongodb make Application not responding:
code part
What code is that?
What is db?
Do you do it in a loop?
Please explain better! -
@jsulm Ok, iam using qtcreator 5, Database mongodb .
above code is placed inside a loop ,loop works when there is data available in socket .Data reads fast from socket, when i put mongodb insertion code here it makes application not responding ,,
can we call mongodb insertion faster??
is that code logic problem or need to do it in thread??