[CXX-1991] Not a legal mongodb url address provided Created: 14/Apr/20 Updated: 27/Oct/23 Resolved: 15/Apr/20 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | 莫 莫 | Assignee: | Unassigned |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Hello, I use mongocxx API to do some demo. Our remote server is built on mongodb. It can be visited via JavaScript and Python. Currently, I want to wrap some MongoDB C++ APIs to use with other applications based on C++. I wrote the code as:
My launch command is:
It is OK for compilation but report error in running:
Looks like this statement "mongocxx::client conn{mongocxx::uri{"http://192.168.888.888"}};" is not correct. Thus, what is the legal statement of Mongodb URL with IP address? Since there is no clear guide for mongodb-c++ development, I just imitate some demo code, may have problem. Thanks & Regards! |
| Comments |
| Comment by 莫 莫 [ 15/Apr/20 ] |
|
Looks like use "mongodb://" instead of "http://", can resolve this problem. |
| Comment by Kevin Albertson [ 14/Apr/20 ] |
|
The connection string should be of the form: "mongodb://192.168.888.888". The MongoDB manual includes a reference for valid connection strings: https://docs.mongodb.com/manual/reference/connection-string/ For future reference, the CXX Jira project is generally limited to bug reports or feature requests. Please feel free to post any questions on the MongoDB Community forum in the Drivers, ODMs, and Connectors category tagged with cxx-driver. |