Fast writing to mongodb in Qt creator 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 this

code segment:

         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);
//
//                        }
type or paste code here