🔌Add a MongoDB connector

How to connect a MongoDB cluster in Toucan

You can use the Toucan MongoDB connector to connect to your MongoDB cluster with a basic authentication and access collections with a aggregation pipeline

With this connection, you can fetch data from your MongoDB cluster to fill your charts and dashboards.

Configuring a MongoDB connection

Follow the steps described in Add a connector, choose MongoDB and fill out the form with the following info:

Field
Format / Type
Description
Example

Name (mandatory)

String

Use it to identify your connection

MyMongoDBConnection

Host (mandatory)

String

The domain name or IP address of your database server, for mongodb atlas you will use the full connection string

mongodb+srv://:@.mongodb.net/?retryWrites=true&w=majority (Mongo Atlas)

Username (mandatory)

String

your login username

my_mongo_user

Password (mandatory)

String

Your login password (will be stored as a secret)

my_mongo_password

SSL

Boolean

Flag to create the connection using SSL

Max_pool_size (optional)

Integer

Maximum number of connections in the connection pool

3 (default: 1)

Retry Policy (optional)

Boolean

Boolean allows to configure a retry policy if the connection is flaky.

  • max attempts: maximum number of retries before giving up

  • max_delay: in seconds, above the connection is dropped

  • wait_time: time in seconds between each retry

Slow Queries' Cache Expiration Time (optional)

Integer

Slow queries' cache expiration time in seconds

Click on the TEST CONNECTION button then SAVE the connection

Create a dataset from a MongoDB connection

To create a dataset from MongoDB, click on the "create from icon", you will then be able to:

  • database: The name of the database you want to query

  • collection: The name of the collection you want to query

  • Add a Query (optional): Use MongoDB aggregation pipeline to queries your collections , and return only the relevant results.

  • After inputting your query,

  • select "Preview" to review the results,

  • and then click "Save" to create a dataset based on your chosen selection.

Misc

Error Handling

The connector handles various error scenarios, including:

  • Unknown database (UnkwownMongoDatabase)

  • Unknown collection (UnkwownMongoCollection)

  • Connection errors

  • Authentication failures

For more info, see the dedicated section Create a new dataset from a dataset

Last updated

Was this helpful?