Server connection with MongoDB C++ Interface

조회 수: 4 (최근 30일)
Arda Aksu
Arda Aksu 2022년 1월 3일
편집: Dionisije Sopic 2022년 8월 11일
Hello,
According to the documentation of new mongodb c++ interface, a server name is required to connect a mongodb server. The format of the connection link for mongodb is below:
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&writeConcern=majority";
I have a <cluster-url> like this;
"cluster0-shard-00-02.zgzdb.mongodb.net:27017"
For server name, I have tried every combination of this string, but I can not connect. I have also tried to look into the connect function but apperantly it is encrypted.
How can I connect to a mongodb server using mongoc function?
Kind regards,
Arda

답변 (1개)

Abhishek Kolla
Abhishek Kolla 2022년 1월 6일
Hi,
You can refer to mongoc for more information on the server name. In addition you would also need to install the Additional Support Package for mongo DB connection, as explained in the following documentation page:
Hope this helps
  댓글 수: 2
Arda Aksu
Arda Aksu 2022년 1월 10일
The additional add-on you mention is for java drivers. In the documentation, it seems that mongoc function uses c++ library and is already included in database toolbox.
The problem is I dont know what to use as server name because every other platform that works with mongoDB uses an url to connect to the database.
The connection link for mongodb is below:
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&writeConcern=majority";
I have a <cluster-url> like this;
"cluster0-shard-00-02.zgzdb.mongodb.net:27017"
What should I use as server name in mongoc function?
Dionisije Sopic
Dionisije Sopic 2022년 8월 11일
편집: Dionisije Sopic 2022년 8월 11일
Has anyone managed to connect to a mongodb using mongoc WITHOUT using localhost and how?
MATLAB always crashes when using the following server argument:
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&writeConcern=majority";

댓글을 달려면 로그인하십시오.

태그

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by