docs/integrations/data-integrations/mongodb.mdx
This documentation describes the integration of MindsDB with MongoDB, a document database with the scalability and flexibility that you want with the querying and indexing that you need.
Before proceeding, ensure the following prerequisites are met:
Establish a connection to MongoDB from MindsDB by executing the following SQL command:
CREATE DATABASE mongodb_datasource
WITH
ENGINE = 'mongodb',
PARAMETERS = {
"host": "mongodb+srv://admin:[email protected]/public"
};
Use the following parameters to establish the connection:
host: The connection string of the MongoDB server that includes user (admin), password (admin_pass), host and port (demo.mongodb.net), and database (public).database: If the connection string does not include the /database path, provide it in this parameter.Alternatively, the following set of connection parameters can be used:
username: The username associated with the database.password: The password to authenticate your access.host: The host of the MongoDB server.port: The port through which TCP/IP connection is to be made.database: The database name to be connected.Retrieve data from a specified collection by providing the integration name and collection name:
SELECT *
FROM mongodb_datasource.my_collection
LIMIT 10;
SELECT or UPDATE query.