Auly
Auly
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
yes, it works after I change getenv and conn[][].I don't know what 's string after '@' in MONGO_URL? I am wrong with conn[string afer@][].
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
thank you so much.this issue trouble me one day. bye.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
ok, change to MONGO_URL
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
so i should change string mongoConnect=std::string(getenv("MONGODB_URI")); to MONGODB_URL? and delete other variables?
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
please more in detail
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
so i should only have MONGO_URL.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
yes, localhost:8080 and localhost:8080/about have a page.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
i write it according a course, when open 8080 port, the page can display, otherwise, it can't display.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
and use these commands to server contacts page:
CROW_ROUTE(app, "/contacts")
([&collection]()
{
mongocxx::options::find opts;
opts.limit(10);
auto docs=collection.find({}, opts);
std::ostringstream os;
for (auto&& doc : docs)
{
os<<bsoncxx::to_json(doc)<<endl;
}
return crow::response(os.str());
});
CROW_ROUTE(app, "/contacts")
([&collection]()
{
mongocxx::options::find opts;
opts.limit(10);
auto docs=collection.find({}, opts);
std::ostringstream os;
for (auto&& doc : docs)
{
os<<bsoncxx::to_json(doc)<<endl;
}
return crow::response(os.str());
});
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
in main.cpp, use below commands get contacts:
mongocxx::instance inst{};
string mongoConnect=std::string(getenv("MONGODB_URI"));
mongocxx::client conn{mongocxx::uri{mongoConnect}};
auto collection=conn["containers-us-west-175.railway.app:7978"]["contacts"];
mongocxx::instance inst{};
string mongoConnect=std::string(getenv("MONGODB_URI"));
mongocxx::client conn{mongocxx::uri{mongoConnect}};
auto collection=conn["containers-us-west-175.railway.app:7978"]["contacts"];
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
yes.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
anyway, why contacts under collections do not display on webpage?
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
ok, my english is not so good.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
but could you continue help sloving my question?
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
I am sorry for you.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
what relation with spam pings?
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
@Brody are you still here?
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
And my localhost:8080 display a html fine.
39 replies
RRailway
Created by Auly on 5/31/2023 in #✋|help
mongodb's collections data can't display on my webpage.
yes, I use "docker run -p 8080:8080 -e PORT=8080 -e MONGODB_URI="mongodb://mongo:[email protected]:7978" hello_crow:latest "
39 replies