This table describes how to address common errors you can encounter while working with the Database Toolbox™ interface for MongoDB®.
Error Category | Error Message | Probable Causes | Resolution |
---|---|---|---|
Installation and configuration | Unable to verify MongoDB Java driver
installation. |
The installation did not install the MongoDB Java® driver successfully. | Reinstall the Database Toolbox interface for MongoDB. For details, see Database Toolbox Interface for MongoDB Installation. |
Unable to find MongoDB Java driver file on MATLAB Java
class path. Install the Database Toolbox interface for MongoDB
again. |
After installation, the MATLAB® preferences folder is missing the
| Reinstall the Database Toolbox interface for MongoDB. For details, see Database Toolbox Interface for MongoDB Installation. | |
MongoDB connection | Invalid Mongo connection. | The MongoDB connection is closed. | Use the mongo function to connect to MongoDB. |
Input validation | Valid input types for server are string scalars and string
array. | In the mongo function, the specified data type
for the input argument server is not a string scalar
or string array. | Specify the input argument server as a string
scalar or string array. |
Each server must have a port. | In the mongo function, the number of servers
specified in the mongo function does not match the
number of ports specified. | Ensure that you specify a port number for each specified server in
the mongo function. For example, if the
server input argument is set to
{"dbtb01","dbtb02"} , then the
port input argument must have two port numbers,
such as [27017,27018] . | |
Valid input type is cell array of
structures. | In the insert function, the
documents input argument is specified as a cell
array. The cell array contains data types that are not
structures. | In the documents input argument of the
insert function, specify only structures in the
cell array. | |
MongoDB Java driver | [Mongo Driver Error]: |
The MongoDB Java driver throws an error. | Use the MongoDB Manual to search for the MongoDB error message. |
MongoDB CRUD operations | Unable to access MongoDB collection
| The database does not contain the specified collection. | Access the CollectionNames property of the
mongo object to retrieve a list of all collections
in the database. Then, specify an existing collection name. |
MongoDB collection
| The database already contains a collection with the specified name. | Access the CollectionNames property of the
mongo object to retrieve a list of all collections
in the database. Then, specify a unique name to create a
collection. |
createCollection
| dropCollection
| insert
| mongo
| remove
| update