No suitable servers found using mongoc connection to DataBase
20 次查看(过去 30 天)
显示 更早的评论
I get an error when trying to start a connection to my database in MongoDB. I am using the code from the documentation:
server = "myIP";
port = 27017;
dbname = "myDBName";
conn = mongoc(server,port,dbname,UserName="user",Password="Pass");
The error I get is as follows: Error using database.mongo.connection
[Mongo Driver Error]: No suitable servers found (`serverSelectionTryOnce` set): [connection timeout
calling ismaster on 'myIP:27017'].
Error in mongoc (line 52)
conn = database.mongo.connection(varargin{:});
Error in mongodb (line 4)
conn = mongoc(server,port,dbname);
I have already verified the connection in the MongoDB shell, I also tried to connect through Compass and in both cases I can connect with my credentials. I turned off the firewall and the error still appears, I hope someone can help me.
0 个评论
回答(1 个)
Piyush Dubey
2023-5-30
Hi Gerado,
[Mongo Driver Error] implicates the error is thrown by MongoDB and later sent towards MATLAB. The following documentation will help you troubleshoot different errors in MongoDB and the Database Toolbox Interface:
These will help you figure out the best practices to use the functionalities provided by the Toolbox to connect to MongoDB data base.
Additionally, this link should be helpful to resolve selection timeout errors in MongoDB:
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!