lganzzzo on master
Add hints and advice to the thr… Merge pull request #396 from ba… (compare)
bamkrs on master
Fix #324 (#395) * Attempt to p… (compare)
oatpp::Object<UserDto> Database::createUser(const oatpp::Object<UserDto> &userDto) {
auto conn = m_pool->acquire();
auto collection = (*conn)[m_databaseName][m_collectionName]; //<-- collection name it can be anything!
collection.insert_one(createMongoDocument(userFromDto(userDto)));
return userDto;
}
You may reimplement it in the way most convenient to you. You are not bound to components
class SimpleExample {
private:
constexpr static const char* TAG = "SimpleExample";
//std::shared_ptr<DemoApiClient>& client; //////this line does not work /////////////
public:
oatpp::String bodyStr;
void createClient() {
auto connectionProvider = tcp::client::ConnectionProvider::createShared({SERVER_ADDRESS, SERVER_PORT_NUMBER});
auto requestExecutor = client::HttpRequestExecutor::createShared(connectionProvider);
auto objectMapper = json::mapping::ObjectMapper::createShared();
auto client = DemoApiClient::createShared(requestExecutor, objectMapper);
runExample(client);
}
void runExample(const std::shared_ptr<DemoApiClient>& client) {
{
bodyStr = client->detectObject(0, "Jpeg data passed to POST")->readBodyToString();
OATPP_LOGD(TAG, "[detectObject] bodyStr = '%s'", bodyStr->c_str());
Hey @nguyenquan263 ,
hey man...about installing mongocxx from your Dockerfile...can you show me a more detail way to install that
I used docker build for it...but nothing change :/
From example-mongodb/readme.md
:
Installing mongocxx on Linux is an unclear and painful process. See ubuntu-cmake-mongocxx/Dockerfile for instructions that worked for us.
And the link to dockerfile - https://github.com/oatpp/dockerfiles/blob/master/ci/ubuntu-cmake-mongocxx/Dockerfile
I used docker build for it...but nothing change :/
What exactly hasn't changed :)? How should I know that?
Hey @junyama , @nguyenquan263
Please note Oat++ chat is for Oat++ specific questions. Please direct c++ general questions and docker questions to the corresponding communities.
Hello @jjmcwill ,
In Oat++, it's a ConnectionHandler that is responsible for connection handling and for how-much threads it will be allocated.
The default HttpConnectionHandler available out-of-the-box will spawn a new thread for each new incoming connection.
If you want to modify this behavior - you can implement your own connection handler or extend the default one and modify its behavior.
const
and &
modifiers
Hey @axelspoerl ,
Please see example here, in the oatpp tests
Yes, the "upload-file" docs are a bit outdated:(
Hey @nguyenquan263 ,
I don't understand the question.
You are setting the userId
from dto->userName
.
What do you mean by default
user id???
oatpp::mongo::bson::ObjectId objId = oatpp::mongo::bson::type::ObjectId();
:Using oatpp::network::server::run(bool) is deprecated and will be removed in the next release. Please implement your own threading.
Is deprecating server::run(true) in the works? If I called server::run() in a separate thread that blocks, how would I cleanly signal that thread to shutdown and clean up?