Main Content

MongoDB C++ Interface

Explore and manage collections of documents in MongoDB® using MongoDB C++ interface

Using the MongoDB C++ interface, you can connect to MongoDB, access documents, and import the stored data into the MATLAB® workspace for analysis. You can also run MongoDB queries against a document collection in MongoDB. To add data to document collections, you can export MATLAB tables, structures, and objects into MongoDB.

Database Toolbox™ includes the MongoDB C driver in the installation.


connectionMongoDB C++ interface connection


expand all

mongocCreate MongoDB C++ interface connection
isopenDetermine if MongoDB C++ interface connection is open
closeClose MongoDB C++ interface connection
countCount total number of documents in MongoDB collection
findRetrieve documents in MongoDB collection
createCollectionCreate MongoDB collection
dropCollectionDrop MongoDB collection
insertInsert one or multiple documents into MongoDB collection
removeRemove one or multiple documents from MongoDB collection
updateUpdate one or multiple documents in MongoDB collection


Import and Analyze Data from MongoDB Using MongoDB C++ Interface

Import all documents from a MongoDB collection into the MATLAB workspace and perform a simple data analysis of numerical fields.

Import Filtered Data from MongoDB Using MongoDB C++ Interface

Filter data using a MongoDB query and import the data into the MATLAB workspace.

Import Large Data from MongoDB Using MongoDB C++ Interface

Import a large set of flight data from a collection into the MATLAB workspace. To avoid out-of-memory issues, import large data in batches.

Export MATLAB Data into MongoDB Using MongoDB C++ Interface

Create a MongoDB collection and insert structure data from the MATLAB workspace into the collection.

Import and Export MATLAB Objects Using MongoDB and MongoDB C++ Interface

Serialize and deserialize objects with MongoDB and MATLAB.