MATLAB: How to resolve “Mongo Driver Error : Timed out after 10000 ms” error

connectiondatabaseDatabase Toolboxerrormongodbtimeouttoolbox

I am trying to connect to the server given in the documentation at the following documentation page:
However the connection through "mongo" function does not succeed and it gives an error after 10 seconds:
[Mongo Driver Error]:Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=dbtb01:27017, type=UNKNOWN, state=CONNECTING}].
Is the server offline? How can I resolve this issue?

Best Answer

Errors that begin with "[Mongo Driver Error]" are errors that are thrown by MongoDB, then propagated to MATLAB. Please refer to the following links to resolve the issue. The first link describes the different types of errors that the Database Toolbox Interface throws, the error you received falls under the MongoDB Java Driver classification. To further debug the error, please refer to the second link, the MongoDB Manual:
A reason the error could be thrown is that it is trying to connect to a database that does not exist. The examples on the documentation pages cannot be run by users, as we do not ship the database with the product. They illustrate how you may use the functionalities from the Database Toolbox to connect to a MongoDB database.