mardi 5 avril 2016

MongoDB 3.2 c++ drivers , using $exists

bsoncxx::builder::stream::document search_builder;

mongocxx::options::find img_find; // This speeds up the queries

search_builder_images.clear();
search_builder_images <<  "_id" << "abc" << "data" << open_document <<"$exists" << true << close_document ;
for (bsoncxx::document::view doc : cursor_cal) {
    std::cout << bsoncxx::to_json(doc) << std::endl;
}

auto cursor_cal = dbMongo[collectionName].find(search_builder.view());

Here randomly 50-50% chances , I sometimes get the output I expect and sometimes I get segmentation fault error.

What am I doing wrong ? ( I am trying to create this search_builder to search in mongodb database and get documents where data exists ? )

Aucun commentaire:

Enregistrer un commentaire