MongoDB Studio Configuration - Mule 4

MongoDB Connector Version 6.0

To configure a connector in Anypoint Studio, follow this process:

  1. Install the connector.

  2. Configure an input source for the connector.

  3. Configure the connector.

Install the Connector Using Exchange

  1. In Studio, create a Mule project.

  2. Click the Exchange (X) icon in the upper left of the Studio task bar.

  3. In Exchange, click Login and supply your Anypoint Platform username and password.

  4. In Exchange, search for MongoDB.

  5. Select MongoDB Connector and click Add to project.

  6. Follow the prompts to install the connector.

Install the Connector in Studio

  1. In Studio, create a Mule project.

  2. In the Mule Palette view, click (X) Search in Exchange.

  3. In Add Modules to Project, type the name of the connector in the search field.

  4. Click the MongoDB Connector name in Available modules.

  5. Click Add.

  6. Click Finish.

Configure an Input Source for the Connector

Configure an input source for the connector, such as the Object Listener operation, HTTP Listener, or Scheduler. The Object Listener operation polls the given MongoDB collection for new documents that apply to the filter and invokes your app when it finds one.

To configure an input source, drag it to the Source area of the Studio canvas.

Configure the Connector

  1. On the Global Elements tab, click Create.

  2. Expand Connector Configuration and search for MongoDB config.

  3. Click OK.

  4. Enter a value for the following properties:

    • Servers (host:port)

      Servers where your MongoDB instance is located, as specified by one or more host:port pairs. The default value is localhost:27017. Follow these steps to add one or more host:port instances:

      1. Select Edit inline.

      2. Click the green plus sign (+).

      3. Add the host:port instance and click Finish.

      4. Repeat steps 2 and 3 for each host:port instance you want to add.

    • Database

      Database that sends and retrieves data from the MongoDB instance

    • Username

      Username to access the MongoDB instance

    • Password

      Corresponding password

Use the MongoDB configuration with Spring property placeholders for the Connection field values when you plan to deploy your application to CloudHub or to Mule runtime engine. You can hard code your connection credentials in the global element properties if you are in the development stage and want to accelerate the development process.

Global Configuration with SSL (Optional)

MongoDB Connector v6.0.0 and later supports the use of SSL, if your MongoDB instance supports it. To set up the global configuration for SSL, select the TLS context field in the Security tab in your MongoDB connection.


By default, logging is enabled via SLF4J API. The driver uses the following logger names:

  • org.mongodb.driver, the root logger

    • cluster, for logs related to monitoring of the MongoDB servers to which the driver connects

    • connection, for logs related to connections and connection pools

    • protocol, for logs related to protocol message sent to and received from a MongoDB server

      • insert, for logs related to insert messages and responses

      • update, for logs related to update messages and responses

      • delete, for logs related to delete messages and responses

      • query, for logs related to query messages and responses

      • getmore, for logs related to getmore messages and responses

      • killcursor, for logs related to killcursor messages and responses

      • command, for logs related to command messages and responses

    • uri, for logs related to connection string parsing

    • management, for logs related to JMX

Next Steps

After configuring Studio, see the Examples topic for more configuration ideas.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub