jeudi 25 janvier 2018

c++ serialization to Mongodb

I am trying to use mongodb as my second tier database for my vector matrix in my C++11 code.

I have std::vector<matrix<float, 0 , 1 >> object_descriptors; vectors and want to insert each of them to mongodb and read back to std::vector<matrix<float, 0 , 1 >> object_descriptors .

like:

for (auto & element : object_descriptors){

    bsoncxx::document::value document =  bsoncxx::builder::basic::make_document
            (kvp("file_name", files[file_count++]),
                         kvp("objectID" , serialize??(element)  ); //i couldnt figure out the proper way. 
                         kvp("created_at", bsoncxx::types::b_date(std::chrono::system_clock::now()));

    bsoncxx::stdx::optional<mongocxx::result::insert_one> result =
                coll.insert_one(document.view());


    auto v = document.view();

    element.size();
}

Appreciate for any help/suggestions.

Aucun commentaire:

Enregistrer un commentaire