Open lganzzzo opened 3 years ago
Until this implemented users can use the following method:
#include "oatpp-mongo/bson/Types.hpp" #include "oatpp/encoding/Hex.hpp" #include "oatpp/core/data/stream/BufferStream.hpp" oatpp::mongo::bson::ObjectId objectIdFromString(const oatpp::String& hexText) { oatpp::data::stream::BufferOutputStream stream(12); oatpp::encoding::Hex::decode(&stream, hexText->getData(), hexText->getSize(), false); if(stream.getCurrentPosition() != 12) { throw std::runtime_error("Error. Invalid string."); } return oatpp::mongo::bson::ObjectId(stream.getData()); } auto objId = objectIdFromString("5f9b6ecb21a7da049662e7d2"); OATPP_LOGD("AAA", "objId='%s'", objId->toString()->c_str());
Until this implemented users can use the following method: