Databases
Connect a Data Source
Description
MindsDB enables adding databases to your Mongo instance using the
db.databases.insertOne()
method.
Our MindsDB Mongo API supports creating a connection by passing the database credentials.
Syntax
Here is the syntax:
Alternatively, you can use the host
parameter alone, providing the connection string, as below:
On execution, we get:
Where:
Name | Description |
---|---|
name | Identifier for the data source to be created. |
engine | Database engine to be selected. |
connection_args | {"key":"value"} object storing the connection parameters such as port, host, database. |
Example
Here is an example of how to connect to the local MongoDB.
On execution, we get:
You can list all the linked databases using the following command:
On execution, we get: