# mulesoft MongoDB Connector - Full Documentation --- product: MongoDB Connector version: 6.3 --- # MongoDB Connector 6.3 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for MongoDB (MongoDB Connector) is a closed-source connector that provides a connection between the Mule runtime engine (Mule) and third-party software on a MongoDB server. Release Notes: [MongoDB Connector Release Notes](https://docs.mulesoft.com/release-notes/connector/mongodb-connector-release-notes-mule-4) Exchange: [MongoDB Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-mongodb-connector/) ## Before You Begin To use this connector, you must be familiar with MongoDB, Mule runtime engine (Mule), Anypoint Connectors, Anypoint Studio, elements in a Mule flow, and global elements. Before creating an app, you must have access to the MongoDB target resource and Anypoint Platform. You must also understand how to create a Mule app using Anypoint Studio. To use the this connector, you need: - A MongoDB instance - A set of valid credentials, including the required MongoDB endpoints that point to your instance ## Common Use Cases for the Connector Common use cases for MongoDB Connector include: - **Single View of Data** Create a single view of your most important data and aggregate your siloed data from multiple enterprise systems, transform the data, and write the data to MongoDB. For example, you can import data into a CSV format from a local directory into MongoDB. - **Mainframe Offloading** Mirror or synchronize your operational data from mainframes into MongoDB to offload workloads from your mainframes while enabling the ability to meet your customer where they are. - **Real-time Analytics** Leverage MongoDB’s rich query language to make real-time decisions on shipping, inventory, and pricing, and analyze any data using documents in MongoDB. - **Personalization** Create personalized omnichannel retail experiences by collecting and synchronizing data across your retail channels and your backend systems into MongoDB. For examples of these use cases, refer to [MongoDB Connector Examples](https://docs.mulesoft.com/mongodb-connector/6.3/mongodb-connector-examples). ## Authentication This connector does not validate all possible authentication types. ## Exchange Example [Anypoint Exchange](https://www.mulesoft.com/exchange/org.mule.examples/importing-a-CSV-file-into-Mongo-DB/) has an example that shows how to import data in a CSV format from a local directory into MongoDB. ## Important Date Handling Considerations When using MongoDB Connector, consider the following date-handling behavior: - **Automatic conversion to UTC** MongoDB Connector converts dates (whether sent to or retrieved from MongoDB) to UTC before storage for consistent date handling in distributed environments. - **ISO 8601 format** Dates (whether they are sent to or retrieved from MongoDB) in JSON documents are transformed to the ISO 8601 format. Additionally, any String values in JSON documents that match the ISO 8601 format are automatically transformed and stored as Date types in MongoDB. This change ensures more consistent and standardized date handling in a distributed environment. - **Millisecond truncation** Dates (whether sent to or retrieved from MongoDB) that include milliseconds with a value of `.000` are not shown in connector output. Here is an example of date handling in a Mule app: Input: ```json { "timeStamp": "2024-06-17T16:44:17.000+01:00" } ``` Mule 4: ```json { "timeStamp": "2024-06-17T15:44:17+00:00" } ``` Because of these changes in date handling, it is important to: - **Review flows involving dates** If your Mule apps rely on specific timezones of dates stored in MongoDB, you must review and possibly adjust flows to correctly handle the UTC conversion. - **Test thoroughly** Conduct thorough testing in a controlled environment to ensure that the changes in date handling do not negatively impact the expected behavior of the Mule app. - **Document the behavioral differences** Review these date-handling details to ensure correct behavior in your application. ## Next Steps After you complete the prerequisites and experiment with the example, you are ready to create an app with [Studio](https://docs.mulesoft.com/mongodb-connector/6.3/mongodb-connector-studio). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.3 --- # MongoDB Connector 6.3 Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Invoke an Operation To invoke a simple operation, such as the **Insert Document** operation, follow these steps: 1. In Studio, click **HTTP** and drag the **Listener** operation to the canvas. 2. From the palette, select **MongoDB** and drag the Insert Document operation into your flow by placing it to the right of **HTTP Listener**. 3. Configure the connector by selecting the **Connector Configuration** you created in the previous section, choosing the operation to invoke, and setting the **Collection name**. 4. From the palette, drag the **Transform Message** component to the left of MongoDB Connector. 5. Click **Transform Message** and enter two key-value pairs: ```dataweave %dw 2.0 %output application/json --- { name:"Peter", age:"42" } ``` 6. From the Mule Palette view, drag other **Transform Message** components to the right of MongoDB Connector. 7. Click **Transform Message** and set the output to `application/json`: ```dataweave %dw 2.0 output application/json --- payload ``` ### XML for Invoke an Operation ```xml ``` ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.3 --- # MongoDB Connector 6.3 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for MongoDB (MongoDB Connector) is a closed-source connector that provides a connection between the Mule runtime engine (Mule) and third-party software on a MongoDB server. ## Configuration Default Configuration for MongoDB Connector.
NameTypeDescriptionDefault ValueRequired

Name

String

Name for this configuration. Connectors reference the configuration with this name.

x

Connection

Connection types for this configuration.

x

Read Concern

Enumeration, one of:

  • LOCAL

  • AVAILABLE

  • MAJORITY

  • LINEARIZABLE

  • SNAPSHOT

Enables you to control the consistency and isolation properties of the data read from replica sets and replica set shards.

Read Preference

Enumeration, one of:

  • PRIMARY

  • PRIMARY_PREFERED

  • SECONDARY

  • SECONDARY_PREFERRED

  • NEAREST

Specifies the read preferences for this connection.

PRIMARY

Maximum Staleness Seconds

Number

Specifies, in seconds, how stale a secondary node on a MongoDB cluster is before the client stops using the secondary node for read operations.

-1

Read Preference Tags

If replica set members are associated with tags, you can specify a tag set (array of tag specification documents) in the read preference to target those members.

Encoding

String

Specifies the encoding to use in the connector. If unspecified, the default for Mule is used.

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

### Connection Type Uses a database, a username, and a password for connection. > [!NOTE] This connector does not validate all possible authentication types.
NameTypeDescriptionDefault ValueRequired

Servers (host:port)

Server in which your MongoDB instance is located. You can specify multiple servers.

x

Database

String

Database name to which you want to connect.

x

Username

String

Username to use for authentication.

Password

String

Password to use for authentication. If you do not want to use authentication, the password and the username must both be empty.

Replica Set Name

String

Name of the replica set to which to connect. Use this field to connect to a MongoDB cluster.

Authentication Source

String

Authentication source.

Compressors

Array of String

List of compressors to enable network compression for communication between the client and a mongod or mongos instance. If you specify multiple compressors, then the order in which you list the compressors matters. The driver uses the first compressor in the list.

Zlib Compression Level

Number

Integer that specifies the compression level if using zlib for network compression. 0 means no compression. 1 through 9 are the compression levels, with 1 being the lowest compression level, and 9 being the highest compression level. Higher compression levels take more time to process than lower compression levels.

-1

Connection Timeout

Number

How long the connector waits before timing out when establishing a connection to the remote service.

30

Connection Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Connection Timeout field.

SECONDS

Local Threshold

Number

Size of the latency window for selecting among multiple suitable MongoDB instances.

15

Local Threshold Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Local Threshold field.

MILLISECONDS

Server Selection Timeout

Number

How long to block for server selection before throwing an exception.

30

Server Selection Timeout Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Server Selection Timeout field.

SECONDS

Socket Timeout

Number

Socket timeout. Used for I/O socket read and write operations. Set this field to 0 if you do not want socket read and write operations to time out.

Socket Timeout Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Socket Timeout field.

SECONDS

Retry Writes

Boolean

Enable retryable writes.

false

Authentication Mechanism

Enumeration, one of:

  • PLAIN

  • SCRAM_SHA_1

  • SCRAM_SHA_256

Authentication mechanism used for this connection.

Tls Context

Configures TLS. If using the HTTPS protocol, you must configure TLS.

Min Connection Pool Size

Number

Minimum size for the connection pool.

Max Connection Pool Size

Number

Maximum size for the connection pool.

100

Max Wait Queue Time

Number

Maximum wait queue time for the connection pool.

120

Max Wait Queue Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Wait Queue Time field.

SECONDS

Max Connection Life Time

Number

Maximum connection lifetime for the connection pool.

Max Connection Life Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Connection Life Time field.

SECONDS

Max Connection Idle Time

Number

Maximum connection idle time for the connection pool.

Max Connection Idle Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Connection Idle Time field.

SECONDS

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

### Connection String Connection Type Uses a connection string for connection. > [!NOTE] This connector does not validate all possible authentication types.
NameTypeDescriptionDefault ValueRequired

Connection String

String

URI that describes the hosts to use and their options.

x

Tls Context

Configures TLS. If using the HTTPS protocol, you must configure TLS.

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

## Sources - [On Object Listener](#object-listener) ### On Object Listener `` Source for object events. > [!NOTE] This source (listener) uses Object Store to save watermarks. You might experience > limitations that are specific to the Object Store implementation you are using (Object Store for > CloudHub deployments or Object Store for on-premises deployments), so configure Object Store to > suit your needs. > For more information, see > [The Different Types of Object Stores Explained](https://help.salesforce.com/s/articleView?id=001123185&type=1).
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Collection that is watched to detect the matching documents.

x

Watermark Field

String

Field that is queried to detect the objects that match the trigger condition.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

Scheduling Strategy

scheduling-strategy

Configures the scheduler that triggers the polling.

x

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) ## Operations - [Add User](#addUser) - [Collection Exists](#collectionExists) - [Count Documents](#countDocuments) - [Create Collection](#createCollection) - [Create File](#createFile) - [Create Index](#createIndex) - [Drop Collection](#dropCollection) - [Drop Database](#dropDatabase) - [Drop Index](#dropIndex) - [Dump](#dump) - [Execute Command](#executeCommand) - [Find Documents](#findDocuments) - [Find Files](#findFiles) - [Get File Content](#getFileContent) - [Insert Document](#insertDocument) - [Insert Documents](#insertDocuments) - [List Collections](#listCollections) - [List Indexes](#listIndexes) - [Map Reduce](#mapReduce) - [Remove Documents](#removeDocuments) - [Remove Files](#removeFiles) - [Restore From Directory](#restoreFromDirectory) - [Restore From File](#restoreFromFile) - [Update Documents](#updateDocuments) ### Add User `` Adds a new user for this database.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Username

String

Name of the user.

x

Password

String

Password to use for authentication.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Collection Exists `` Returns `true` if the specified collection exists.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Boolean

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Count Documents `` Counts the number of documents that match the given query. If no query is passed, the operation returns the number of elements in the collection.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Target collection.

x

Query

Binary

Query for counting documents. Only documents matching the query are counted. If unspecified, all documents are counted. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Number

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Create Collection `` Creates a new collection. If the collection already exists, a `MongoException` is thrown.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to create.

x

Max Objects

Number

Maximum number of documents the new collection contains.

Collection Size

Number

Maximum size of the new collection.

Collection Size Data Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit of the Collection Size field.

BYTE

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Create File `` Creates a new file in the database, saving the specified content, file name, content type, and extra data.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Content

Binary

Content of the new file. This content is an InputStream.

#[payload]

x

Filename

String

Name of the new file.

x

Metadata

Binary

JSON object that holds information to store.

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Create Index `` Creates a new index.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection in which the index is created.

x

Field Name

String

Name of the field that is indexed.

x

Sort Order

Enumeration, one of:

  • ASC

  • DESC

Indexing order.

ASC

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

String

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Drop Collection `` Deletes a collection and all the objects it contains. If the collection does not exist, the operation throws a `NOT_FOUND` error.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to drop.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Drop Database `` Drop the current database.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Database Name

String

Name of the database to drop.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Drop Index `` Drops an existing index.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection.

x

Index Name

String

Name of the index to drop.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Dump `` Executes a dump of the database to the specified output directory. If no output directory is provided, the default /dump directory is used.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Output Directory

String

Output directory in which dump files are created.

x

Output Name Prefix

String

Output file name prefix. If unspecified, the database name is used.

Oplog

Boolean

Point in time backup (requires an oplog).

false

Operation Timeout

Number

Maximum wait time for the dump.

60

Operation Timeout Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Operation Timeout field.

SECONDS

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of String

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Execute Command `` Executes a command on the database. The **Execute Command** operation results are not paginated. If an execution returns a cursor reference, use the `getMore` command to retrieve the next page of results. Refer to [Additional Configuration Information](https://docs.mulesoft.com/mongodb-connector/6.3/mongodb-connector-additional-configuration) for more details.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Command

Binary

Command to execute on the database as a document.

#[payload]

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Find Documents `` Finds all documents that match a given query. If no query is specified, all documents of the collection are retrieved. If no fields object is specified, all fields are retrieved.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Query

Binary

Query for finding documents. If unspecified, all documents are retrieved. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Sort By

Binary

Indicates the document used to sort the results. Use [{"yourField":"ASC"}] to sort by ascending, or [{"yourField":"DESC"}] to sort by descending.

Page Size

Number

Size of the documents of each page to return.

100

Limit

Number

Limit of the documents to return.

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Collection Name

String

Collection name.

x

Fields

String

Comma-separated list of fields to return from each document. To return all fields, type a single comma character.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Find Files `` Lists all files that match the given query.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Query

Binary

Query for listing all files. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Sort

Binary

Enables you to sort the result list. A file is sorted by file ID or upload date.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT-FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Get File Content `` Gets an InputStream to the content of the file specified by **File Id**.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

File Id

Binary

Mandatory file ID.

#[payload]

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Any

Attributes Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Insert Document `` Inserts a document in a collection. If you do not use the `id` field to specify an object, MongoDB automatically generates an ID.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection in which to insert the given document.

x

Document

Binary

Document to insert.

#[payload]

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Insert Documents `` Inserts a document in a collection. If you don’t use the `id` field to specify an object, MongoDB automatically generates an ID.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection in which to insert the given document.

x

Documents

Binary

List of the documents to insert.

#[payload]

Write Ordered

Boolean

Indicates whether the list of documents are executed in order. If set to true and an error occurs during the processing of one of the write operations, MongoDB returns without processing any remaining write operations in the list.

false

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Bulk Operation Result

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### List Collections `` Lists names of collections available on this database.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of String

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### List Indexes `` Lists existent indexes in a collection.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of Index

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Map Reduce `` Transforms a collection into a collection of aggregated groups, as follows: 1. Applies a supplied element-mapping function to each element, which transforms each element into a key-value pair. 2. Groups the resulting pairs by key. 3. Reduces values in each group by applying a supplied 'reduce' function coded in JavaScript. Refer to the MongoDB documentation for more information.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to map and reduce.

x

Mapping Function

String

JavaScript-encoded mapping function.

x

Reduce Function

String

JavaScript-encoded reducing function.

x

Output Collection

String

Name of the output collection to which to write the results. This replaces an existing collection, if any exists. This field is mandatory if the resulting objects are larger than 16 MB. If Output Collection is unspecified, the computation is performed in-memory and is not persisted.

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Remove Documents `` Removes all the documents that match the specified query. If a query is not specified, all documents are removed. It is more efficient to drop a connection and re-create it than to use this operation.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Collection for which to remove elements.

x

Query

Binary

Query for detecting the elements to delete. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Number

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Remove Files `` Removes the file that matches the given file ID. If no file ID is specified, all files are removed.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

File Id

Binary

ID of the file to delete.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Restore From Directory `` Takes the output from the **Dump** operation, restores the output, and generates indexes. This operation inserts records only when the IDs do not already exist in the database.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Input Path

String

Input path of the dump files. This path must be a directory.

x

Drop Collections

Boolean

Indicates whether to drop existing collections before performing the restore.

false

Oplog Replay

Boolean

Replay oplog used for point-in-time restore.

false

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Restore From File `` Restores a single .bson file or a zip file.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to restore.

x

Input

Binary

InputStream that points to the dump file. It can be a .bson file or a zip file.

#[payload]

Drop Collection

Boolean

Indicates whether to drop existing collections before performing the restore.

false

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Update Documents `` Updates documents that match the specified query. If a query is not specified, all documents are retrieved. If the multi parameter is set to `false`, only the first document matching the query is updated. Otherwise, all documents matching the query are updated.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to update.

x

Query

Binary

Query for detecting the element to update. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Content To Update

Binary

Object to replace the document that matches the query.

#[payload]

Multiple Update

Boolean

Indicates whether only the first document matching the query is updated.

false

Upsert

Boolean

If set to true, creates a new document when no document matches the query criteria. The default value is false, which does not insert a new document when no match is found.

false

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Any

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ## Object Types - [Bulk Item](#BulkItem) - [Bulk Operation Result](#BulkOperationResult) - [Crl File](#crl-file) - [Custom Ocsp Responder](#custom-ocsp-responder) - [Expiration Policy](#ExpirationPolicy) - [Index](#Index) - [Key Store](#KeyStore) - [Read Preference Tag](#ReadPreferenceTag) - [Reconnect](#reconnect) - [Reconnect Forever](#reconnect-forever) - [Reconnection](#Reconnection) - [Redelivery Policy](#RedeliveryPolicy) - [Repeatable File Store Iterable](#repeatable-file-store-iterable) - [Repeatable File Store Stream](#repeatable-file-store-stream) - [Repeatable In Memory Iterable](#repeatable-in-memory-iterable) - [Repeatable In Memory Stream](#repeatable-in-memory-stream) - [Server Address](#ServerAddress) - [Standard Revocation Check](#standard-revocation-check) - [Tls](#Tls) - [Trust Store](#TrustStore) ### Bulk Item Bulk item type.
FieldTypeDescriptionDefault ValueRequired

Exception

Any

Exception.

Id

Any

ID.

Message

String

Message.

Payload

Binary

Payload.

Status Code

String

Status code.

Successful

Boolean

Indicates success.

### Bulk Operation Result Bulk operation result type.
FieldTypeDescriptionDefault ValueRequired

Id

Any

ID.

Items

Array of Bulk Item

Array of items.

Successful

Boolean

Indicates success.

### Crl File Specifies the location of the certification revocation list (CRL) file.
FieldTypeDescriptionDefault ValueRequired

Path

String

Path to the CRL file.

### Custom Ocsp Responder Configures a custom OCSP responder for certification revocation checks.
FieldTypeDescriptionDefault ValueRequired

Url

String

URL of the OCSP responder.

Cert Alias

String

Alias of the signing certificate for the OCSP response. If specified, the alias must be in the truststore.

### Expiration Policy Configures an expiration policy strategy.
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Idle Time field.

### Index Index type.
FieldTypeDescriptionDefault ValueRequired

Field Name

String

Field name.

Name

String

Name of the index.

Order

Enumeration, one of:

  • ASC

  • DESC

Order of the index.

### Key Store Configures the keystore for the TLS protocol. The keystore you generate contains a private key and a public certificate.
FieldTypeDescriptionDefault ValueRequired

Path

String

Path to the keystore. Mule resolves the path relative to the current classpath and file system.

Type

String

Type of keystore.

Alias

String

Alias of the key to use when the keystore contains multiple private keys. By default, Mule uses the first key in the file.

Key Password

String

Password used to protect the private key.

Password

String

Password used to protect the keystore.

Algorithm

String

Encryption algorithm that the keystore uses.

### Read Preference Tag Read preference tag type.
FieldTypeDescriptionDefault ValueRequired

Name Value

Object

Name value.

x

### Reconnect Configures a standard reconnection strategy, which specifies how often to reconnect and how many reconnection attempts the connector source or operation can make.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

Count

Number

How many reconnection attempts the Mule app can make.

### Reconnect Forever Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

### Reconnection Configures a reconnection strategy for an operation.
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

What to do if, when an app is deployed, a connectivity test does not pass after exhausting the associated reconnection strategy:

  • true

    Allow the deployment to fail.

  • false

    Ignore the results of the connectivity test.

Reconnection Strategy

Reconnection strategy to use.

### Redelivery Policy Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.

Message Digest Algorithm

String

Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned.

Id Expression

String

One or more expressions that determine if a message is redelivered. This property can be set only if the Use Secure Hash field is false.

Object Store

ObjectStore

Configures the object store that stores the redelivery counter for each message.

### Repeatable File Store Iterable Repeatable file store iterable type.
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

Maximum amount of instances to keep in memory. If more than that is required, content on the disk is buffered.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Repeatable File Store Stream Configures the repeatable file-store streaming strategy by which Mule keeps a portion of the stream content in memory. If the stream content is larger than the configured buffer size, Mule backs up the buffer’s content to disk and then clears the memory.
FieldTypeDescriptionDefault ValueRequired

In Memory Size

Number

Maximum amount of memory that the stream can use for data. If the amount of memory exceeds this value, Mule buffers the content to disk. To optimize performance:

  • Configure a larger buffer size to avoid the number of times Mule needs to write the buffer on disk. This increases performance, but it also limits the number of concurrent requests your application can process, because it requires additional memory.

  • Configure a smaller buffer size to decrease memory load at the expense of response time.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Repeatable In Memory Iterable Repeatable in memory iterable type.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Amount of instances to initially keep in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the Buffer Size Increment attribute, with an upper limit of Max In Memory Size. Default value is 100 instances.

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower means that the buffer must not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full. Default value is 100 instances.

Max Buffer Size

Number

Maximum amount of memory to use. If more than that is used, a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to 0 means no limit.

### Repeatable In Memory Stream Configures the in-memory streaming strategy by which the request fails if the data exceeds the MAX buffer size. Always run performance tests to find the optimal buffer size for your specific use case.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Initial amount of memory to allocate to the data stream. If the streamed data exceeds this value, the buffer expands by Buffer Size Increment, with an upper limit of Max In Memory Size value.

Buffer Size Increment

Number

Amount by which the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower specifies that the buffer can’t expand.

Max Buffer Size

Number

The maximum amount of memory to use. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to zero means no limit.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the Initial Buffer Size, Buffer Size Increment, and Buffer Unit fields.

### Server Address Server address type.
FieldTypeDescriptionDefault ValueRequired

Host

String

Host to which you want to connect.

x

Port

Number

Port of the host to which you want to connect.

27017

### Standard Revocation Check Configures standard revocation checks for TLS certificates.
FieldTypeDescriptionDefault ValueRequired

Only End Entities

Boolean

Which elements to verify in the certificate chain:

  • true

    Verify only the last element in the certificate chain.

  • false

    Verify all elements in the certificate chain.

Prefer Crls

Boolean

How to check certificate validity:

  • true

    Check the Certification Revocation List (CRL) for certificate validity.

  • false

    Use the Online Certificate Status Protocol (OCSP) to check certificate validity.

No Fallback

Boolean

Whether to use the secondary method to check certificate validity:

  • true

    Use the method that wasn’t specified in the Prefer Crls field (the secondary method) to check certificate validity.

  • false

    Do not use the secondary method to check certificate validity.

Soft Fail

Boolean

What to do if the revocation server can’t be reached or is busy:

  • true

    Avoid verification failure.

  • false

    Allow the verification to fail.

### Tls Configures TLS to provide secure communications for the Mule app.
FieldTypeDescriptionDefault ValueRequired

Enabled Protocols

String

Comma-separated list of protocols enabled for this context.

Enabled Cipher Suites

String

Comma-separated list of cipher suites enabled for this context.

Trust Store

Configures the TLS truststore.

Key Store

Configures the TLS keystore.

Revocation Check

Configures a revocation checking mechanism.

### Trust Store Configures the truststore for TLS.
FieldTypeDescriptionDefault ValueRequired

Path

String

Path to the truststore. Mule resolves the path relative to the current classpath and file system.

Password

String

Password used to protect the truststore.

Type

String

Type of truststore.

Algorithm

String

Encryption algorithm that the truststore uses.

Insecure

Boolean

If true, Mule stops performing certificate validations. Setting this to true can make connections vulnerable to attacks.

## System Properties You can configure this system property for the MongoDB Connector:
PropertyDefaultDescription

com.mulesoft.connector.mongo.skipIsoCoercionUnderOperatorKeys

false

When set to true, ISO-8601 strings nested under MongoDB query operator keys (keys prefixed with $, such as $match, $and, $or, $elemMatch, $expr, and $lte) are passed through verbatim as strings instead of being auto-coerced to BSON Date values. Use this property only if you query String-typed date fields through operator expressions and the queries return empty results unexpectedly.

> [!NOTE] This system property applies JVM-wide to all MongoDB Connector configurations and > operations, and takes effect only after a Mule app restart. > > If your app relies on ISO-8601 auto-coercion for fields that store genuine BSON Date values, use > Extended JSON notation (`{"$date": "…​"}`) or DataWeave date types instead of enabling this > property. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.3 --- # MongoDB Connector 6.3 XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt If you manually code a Mule app in XML either from the Anypoint Studio XML editor or from a text editor, you can get access to Anypoint Connector for MongoDB (MongoDB Connector) in your app by adding reference statements to your XML Mule flow and in the Apache Maven `pom.xml` file. You can avoid the manual process described in this topic by using Studio. When you install MongoDB Connector in Studio, Studio automatically populates the XML code with the MongoDB Connector namespace and schema location, and adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/mongodb http://www.mulesoft.org/schema/mule/mongodb/current/mule-mongo.xsd ``` This example shows how the namespace statements are placed in the XML block: ```xml ``` ## Add a POM File Dependency The `pom.xml` Maven file generated by Studio contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.connectors mule-mongodb-connector 6.x.x mule-plugin ``` To obtain the most up-to-date `pom.xml` file information, access the connector in [Anypoint Exchange](https://www.mulesoft.com/exchange/) and click **Dependency Snippets**. Replace `6.x.x` in the `` element with your MongoDB version. ## Next Steps After completing your namespace and `pom.xml` file, you can try the MongoDB [Examples](https://docs.mulesoft.com/mongodb-connector/6.3/mongodb-connector-examples). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.4 is-latest-version: true --- # MongoDB Connector 6.4 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for MongoDB (MongoDB Connector) is a closed-source connector that provides a connection between the Mule runtime engine (Mule) and third-party software on a MongoDB server. Release Notes: [MongoDB Connector Release Notes](https://docs.mulesoft.com/release-notes/connector/mongodb-connector-release-notes-mule-4) Exchange: [MongoDB Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-mongodb-connector/) ## Before You Begin To use this connector, you must be familiar with MongoDB, Mule runtime engine (Mule), Anypoint Connectors, Anypoint Studio, elements in a Mule flow, and global elements. Before creating an app, you must have access to the MongoDB target resource and Anypoint Platform. You must also understand how to create a Mule app using Anypoint Studio. To use the this connector, you need: - A MongoDB instance - A set of valid credentials, including the required MongoDB endpoints that point to your instance ## Common Use Cases for the Connector Common use cases for MongoDB Connector include: - **Single View of Data** Create a single view of your most important data and aggregate your siloed data from multiple enterprise systems, transform the data, and write the data to MongoDB. For example, you can import data into a CSV format from a local directory into MongoDB. - **Mainframe Offloading** Mirror or synchronize your operational data from mainframes into MongoDB to offload workloads from your mainframes while enabling the ability to meet your customer where they are. - **Real-time Analytics** Leverage MongoDB’s rich query language to make real-time decisions on shipping, inventory, and pricing, and analyze any data using documents in MongoDB. - **Personalization** Create personalized omnichannel retail experiences by collecting and synchronizing data across your retail channels and your backend systems into MongoDB. For examples of these use cases, refer to [MongoDB Connector Examples](https://docs.mulesoft.com/mongodb-connector/latest/mongodb-connector-examples). ## Authentication This connector does not validate all possible authentication types. ## Exchange Example [Anypoint Exchange](https://www.mulesoft.com/exchange/org.mule.examples/importing-a-CSV-file-into-Mongo-DB/) has an example that shows how to import data in a CSV format from a local directory into MongoDB. ## Important Date Handling Considerations When using MongoDB Connector, consider the following date-handling behavior: - **Automatic conversion to UTC** MongoDB Connector converts dates (whether sent to or retrieved from MongoDB) to UTC before storage for consistent date handling in distributed environments. - **ISO 8601 format** Dates (whether they are sent to or retrieved from MongoDB) in JSON documents are transformed to the ISO 8601 format. Additionally, any String values in JSON documents that match the ISO 8601 format are automatically transformed and stored as Date types in MongoDB. This change ensures more consistent and standardized date handling in a distributed environment. - **Millisecond truncation** Dates (whether sent to or retrieved from MongoDB) that include milliseconds with a value of `.000` are not shown in connector output. Here is an example of date handling in a Mule app: Input: ```json { "timeStamp": "2024-06-17T16:44:17.000+01:00" } ``` Mule 4: ```json { "timeStamp": "2024-06-17T15:44:17+00:00" } ``` Because of these changes in date handling, it is important to: - **Review flows involving dates** If your Mule apps rely on specific timezones of dates stored in MongoDB, you must review and possibly adjust flows to correctly handle the UTC conversion. - **Test thoroughly** Conduct thorough testing in a controlled environment to ensure that the changes in date handling do not negatively impact the expected behavior of the Mule app. - **Document the behavioral differences** Review these date-handling details to ensure correct behavior in your application. ## Next Steps After you complete the prerequisites and experiment with the example, you are ready to create an app with [Studio](https://docs.mulesoft.com/mongodb-connector/latest/mongodb-connector-studio). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.4 is-latest-version: true --- # MongoDB Connector 6.4 Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Invoke an Operation To invoke a simple operation, such as the **Insert Document** operation, follow these steps: 1. In Studio, click **HTTP** and drag the **Listener** operation to the canvas. 2. From the palette, select **MongoDB** and drag the Insert Document operation into your flow by placing it to the right of **HTTP Listener**. 3. Configure the connector by selecting the **Connector Configuration** you created in the previous section, choosing the operation to invoke, and setting the **Collection name**. 4. From the palette, drag the **Transform Message** component to the left of MongoDB Connector. 5. Click **Transform Message** and enter two key-value pairs: ```dataweave %dw 2.0 %output application/json --- { name:"Peter", age:"42" } ``` 6. From the Mule Palette view, drag other **Transform Message** components to the right of MongoDB Connector. 7. Click **Transform Message** and set the output to `application/json`: ```dataweave %dw 2.0 output application/json --- payload ``` ### XML for Invoke an Operation ```xml ``` ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.4 is-latest-version: true --- # MongoDB Connector 6.4 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for MongoDB (MongoDB Connector) is a closed-source connector that provides a connection between the Mule runtime engine (Mule) and third-party software on a MongoDB server. ## Configuration Default Configuration for MongoDB Connector.
NameTypeDescriptionDefault ValueRequired

Name

String

Name for this configuration. Connectors reference the configuration with this name.

x

Connection

Connection types for this configuration.

x

Read Concern

Enumeration, one of:

  • LOCAL

  • AVAILABLE

  • MAJORITY

  • LINEARIZABLE

  • SNAPSHOT

Enables you to control the consistency and isolation properties of the data read from replica sets and replica set shards.

Read Preference

Enumeration, one of:

  • PRIMARY

  • PRIMARY_PREFERED

  • SECONDARY

  • SECONDARY_PREFERRED

  • NEAREST

Specifies the read preferences for this connection.

PRIMARY

Maximum Staleness Seconds

Number

Specifies, in seconds, how stale a secondary node on a MongoDB cluster is before the client stops using the secondary node for read operations.

-1

Read Preference Tags

If replica set members are associated with tags, you can specify a tag set (array of tag specification documents) in the read preference to target those members.

Encoding

String

Specifies the encoding to use in the connector. If unspecified, the default for Mule is used.

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

### Connection Type Uses a database, a username, and a password for connection. > [!NOTE] This connector does not validate all possible authentication types.
NameTypeDescriptionDefault ValueRequired

Servers (host:port)

Server in which your MongoDB instance is located. You can specify multiple servers.

x

Database

String

Database name to which you want to connect.

x

Username

String

Username to use for authentication.

Password

String

Password to use for authentication. If you do not want to use authentication, the password and the username must both be empty.

Replica Set Name

String

Name of the replica set to which to connect. Use this field to connect to a MongoDB cluster.

Authentication Source

String

Authentication source.

Compressors

Array of String

List of compressors to enable network compression for communication between the client and a mongod or mongos instance. If you specify multiple compressors, then the order in which you list the compressors matters. The driver uses the first compressor in the list.

Zlib Compression Level

Number

Integer that specifies the compression level if using zlib for network compression. 0 means no compression. 1 through 9 are the compression levels, with 1 being the lowest compression level, and 9 being the highest compression level. Higher compression levels take more time to process than lower compression levels.

-1

Connection Timeout

Number

How long the connector waits before timing out when establishing a connection to the remote service.

30

Connection Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Connection Timeout field.

SECONDS

Local Threshold

Number

Size of the latency window for selecting among multiple suitable MongoDB instances.

15

Local Threshold Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Local Threshold field.

MILLISECONDS

Server Selection Timeout

Number

How long to block for server selection before throwing an exception.

30

Server Selection Timeout Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Server Selection Timeout field.

SECONDS

Socket Timeout

Number

Socket timeout. Used for I/O socket read and write operations. Set this field to 0 if you do not want socket read and write operations to time out.

Socket Timeout Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Socket Timeout field.

SECONDS

Retry Writes

Boolean

Enable retryable writes.

false

Authentication Mechanism

Enumeration, one of:

  • PLAIN

  • SCRAM_SHA_1

  • SCRAM_SHA_256

Authentication mechanism used for this connection.

Tls Context

Configures TLS. If using the HTTPS protocol, you must configure TLS.

Min Connection Pool Size

Number

Minimum size for the connection pool.

Max Connection Pool Size

Number

Maximum size for the connection pool.

100

Max Wait Queue Time

Number

Maximum wait queue time for the connection pool.

120

Max Wait Queue Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Wait Queue Time field.

SECONDS

Max Connection Life Time

Number

Maximum connection lifetime for the connection pool.

Max Connection Life Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Connection Life Time field.

SECONDS

Max Connection Idle Time

Number

Maximum connection idle time for the connection pool.

Max Connection Idle Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Connection Idle Time field.

SECONDS

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

### Connection String Connection Type Uses a connection string for connection. > [!NOTE] This connector does not validate all possible authentication types.
NameTypeDescriptionDefault ValueRequired

Connection String

String

URI that describes the hosts to use and their options.

x

Tls Context

Configures TLS. If using the HTTPS protocol, you must configure TLS.

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

### OAuth 2.0 - Client Credentials Connection Type Uses the OAuth 2.0 (OIDC) client credentials grant to connect to MongoDB. The connector performs the OAuth client\_credentials token POST itself so that you can place the optional audience parameter in the form-encoded request body, which Auth0, Atlassian, and similar identity providers require. The connector then feeds the acquired token into the MongoDB driver through the OIDC callback.
NameTypeDescriptionDefault ValueRequired

Servers (host:port)

Server in which your MongoDB instance is located. You can specify multiple servers.

x

Username

String

Username to use for authentication.

Database

String

Database name to which you want to connect.

admin

Audience

String

Optional OAuth 2.0 audience parameter that some identity providers, such as Auth0, require. The connector sends this value in the form-encoded request body to the token endpoint.

Custom Token Request Parameters

Object

Additional form-encoded parameters that the connector appends to the OAuth token POST body. Use this field for identity-provider-specific fields beyond the RFC standards (for example, Microsoft Entra v1 resource, Auth0 organization, Okta claims).

Include Accept Header

Boolean

When true, the connector sends Accept: application/json on the OAuth token request. Set this field to false for identity providers that reject the header.

true

Client Authentication

Enumeration, one of:

  • BASIC_AUTHENTICATION_HEADER

  • BODY

Determines how the connector presents client credentials to the token endpoint, per RFC 6749 §2.3.1. BASIC_AUTHENTICATION_HEADER (client_secret_basic, the RFC-recommended default) sends the credentials in an HTTP Basic Authorization header. BODY (client_secret_post) sends the credentials as form fields in the request body. The connector always sends other parameters, such as audience, scope, and custom parameters, in the body.

BASIC_AUTHENTICATION_HEADER

Allow Invalid Hostnames

Boolean

Disables TLS hostname verification on the MongoDB connection only. Set this field to true when an NLB or proxy fronts your MongoDB Atlas traffic and its certificate CN/SAN does not match the connection hostname. The OAuth token endpoint always verifies hostnames, so this field does not affect identity provider TLS. Do not use this field in production or FIPS environments: disabling hostname verification removes a control that FIPS 140-3 requires, so the connector fails fast when you set this field to true and Mule is in FIPS mode.

false

Direct Connection

Boolean

Connects directly to the configured server address without performing replica-set or topology discovery. Set this field to true when a single NLB, proxy, or HAProxy endpoint fronts your MongoDB Atlas deployment, where discovery would otherwise return real cluster member hostnames that you cannot reach. The connector honors this field only when you configure a single server address.

false

Token Endpoint Proxy

Optional HTTP proxy through which the connector routes the OAuth token requests to the identity provider. This proxy does not affect the MongoDB connection itself.

Tls Context

Configures TLS. If using the HTTPS protocol, you must configure TLS.

Client ID

String

OAuth 2.0 client identifier that the identity provider issues.

x

Client Secret

String

OAuth 2.0 client secret that the identity provider issues.

x

Token URL

String

Token endpoint URL of the identity provider.

x

Scopes

String

Space-separated OAuth 2.0 scopes to request from the identity provider.

Connection Timeout

Number

How long the connector waits before timing out when establishing the socket connection. 0 is infinite.

30

Connection Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Connection Timeout field.

SECONDS

Socket Timeout

Number

Socket timeout that the connector uses for I/O socket read and write operations. Set this field to 0 if you do not want socket read and write operations to time out.

Socket Timeout Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Socket Timeout field.

SECONDS

Server Selection Timeout

Number

How long to block for server selection before throwing an exception.

30

Server Selection Timeout Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Server Selection Timeout field.

SECONDS

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

Min Connection Pool Size

Number

Minimum size for the connection pool.

Max Connection Pool Size

Number

Maximum size for the connection pool.

100

Max Wait Queue Time

Number

Maximum wait queue time for the connection pool.

120

Max Wait Queue Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Wait Queue Time field.

SECONDS

Max Connection Life Time

Number

Maximum connection lifetime for the connection pool.

Max Connection Life Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Connection Life Time field.

SECONDS

Max Connection Idle Time

Number

Maximum connection idle time for the connection pool.

Max Connection Idle Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Connection Idle Time field.

SECONDS

Token Refresh Skew

Number

Time that the connector subtracts from the OAuth expires_in value when determining how long to keep the cached bearer token. Larger values trigger earlier refetches and absorb clock skew between the Mule worker and the identity provider.

60

Token Refresh Skew Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Token Refresh Skew field.

SECONDS

Token Request Timeout

Number

Maximum time that the connector allows the OAuth token POST to take. The connector sends this value as the connection-level timeout to the underlying HTTP client. If the identity provider does not respond within this window, the connector aborts the request and connection establishment fails.

30

Token Request Timeout Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Token Request Timeout field.

SECONDS

## Sources - [On Object Listener](#object-listener) ### On Object Listener `` Source for object events. > [!NOTE] This source (listener) uses Object Store to save watermarks. You might experience > limitations that are specific to the Object Store implementation you are using (Object Store for > CloudHub deployments or Object Store for on-premises deployments), so configure Object Store to > suit your needs. > For more information, see > [The Different Types of Object Stores Explained](https://help.salesforce.com/s/articleView?id=001123185&type=1).
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Collection that is watched to detect the matching documents.

x

Watermark Field

String

Field that is queried to detect the objects that match the trigger condition.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

Scheduling Strategy

scheduling-strategy

Configures the scheduler that triggers the polling.

x

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) ## Operations - [Add User](#addUser) - [Collection Exists](#collectionExists) - [Count Documents](#countDocuments) - [Create Collection](#createCollection) - [Create File](#createFile) - [Create Index](#createIndex) - [Drop Collection](#dropCollection) - [Drop Database](#dropDatabase) - [Drop Index](#dropIndex) - [Dump](#dump) - [Execute Command](#executeCommand) - [Find Documents](#findDocuments) - [Find Files](#findFiles) - [Get File Content](#getFileContent) - [Insert Document](#insertDocument) - [Insert Documents](#insertDocuments) - [List Collections](#listCollections) - [List Indexes](#listIndexes) - [Map Reduce](#mapReduce) - [Remove Documents](#removeDocuments) - [Remove Files](#removeFiles) - [Restore From Directory](#restoreFromDirectory) - [Restore From File](#restoreFromFile) - [Update Documents](#updateDocuments) ### Add User `` Adds a new user for this database.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Username

String

Name of the user.

x

Password

String

Password to use for authentication.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Collection Exists `` Returns `true` if the specified collection exists.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Boolean

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Count Documents `` Counts the number of documents that match the given query. If no query is passed, the operation returns the number of elements in the collection.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Target collection.

x

Query

Binary

Query for counting documents. Only documents matching the query are counted. If unspecified, all documents are counted. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Number

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Create Collection `` Creates a new collection. If the collection already exists, a `MongoException` is thrown.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to create.

x

Max Objects

Number

Maximum number of documents the new collection contains.

Collection Size

Number

Maximum size of the new collection.

Collection Size Data Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit of the Collection Size field.

BYTE

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Create File `` Creates a new file in the database, saving the specified content, file name, content type, and extra data.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Content

Binary

Content of the new file. This content is an InputStream.

#[payload]

x

Filename

String

Name of the new file.

x

Metadata

Binary

JSON object that holds information to store.

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Create Index `` Creates a new index.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection in which the index is created.

x

Field Name

String

Name of the field that is indexed.

x

Sort Order

Enumeration, one of:

  • ASC

  • DESC

Indexing order.

ASC

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

String

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Drop Collection `` Deletes a collection and all the objects it contains. If the collection does not exist, the operation throws a `NOT_FOUND` error.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to drop.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Drop Database `` Drop the current database.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Database Name

String

Name of the database to drop.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Drop Index `` Drops an existing index.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection.

x

Index Name

String

Name of the index to drop.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Dump `` Executes a dump of the database to the specified output directory. If no output directory is provided, the default /dump directory is used.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Output Directory

String

Output directory in which dump files are created.

x

Output Name Prefix

String

Output file name prefix. If unspecified, the database name is used.

Oplog

Boolean

Point in time backup (requires an oplog).

false

Operation Timeout

Number

Maximum wait time for the dump.

60

Operation Timeout Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Operation Timeout field.

SECONDS

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of String

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Execute Command `` Executes a command on the database. The **Execute Command** operation results are not paginated. If an execution returns a cursor reference, use the `getMore` command to retrieve the next page of results. Refer to [Additional Configuration Information](https://docs.mulesoft.com/mongodb-connector/latest/mongodb-connector-additional-configuration) for more details.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Command

Binary

Command to execute on the database as a document.

#[payload]

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Find Documents `` Finds all documents that match a given query. If no query is specified, all documents of the collection are retrieved. If no fields object is specified, all fields are retrieved.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Query

Binary

Query for finding documents. If unspecified, all documents are retrieved. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Sort By

Binary

Indicates the document used to sort the results. Use [{"yourField":"ASC"}] to sort by ascending, or [{"yourField":"DESC"}] to sort by descending.

Page Size

Number

Size of the documents of each page to return.

100

Limit

Number

Limit of the documents to return.

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Collection Name

String

Collection name.

x

Fields

String

Comma-separated list of fields to return from each document. To return all fields, type a single comma character.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Find Files `` Lists all files that match the given query.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Query

Binary

Query for listing all files. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Sort

Binary

Enables you to sort the result list. A file is sorted by file ID or upload date.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT-FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Get File Content `` Gets an InputStream to the content of the file specified by **File Id**.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

File Id

Binary

Mandatory file ID.

#[payload]

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Any

Attributes Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Insert Document `` Inserts a document in a collection. If you do not use the `id` field to specify an object, MongoDB automatically generates an ID.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection in which to insert the given document.

x

Document

Binary

Document to insert.

#[payload]

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Insert Documents `` Inserts a document in a collection. If you don’t use the `id` field to specify an object, MongoDB automatically generates an ID.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection in which to insert the given document.

x

Documents

Binary

List of the documents to insert.

#[payload]

Write Ordered

Boolean

Indicates whether the list of documents are executed in order. If set to true and an error occurs during the processing of one of the write operations, MongoDB returns without processing any remaining write operations in the list.

false

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Bulk Operation Result

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### List Collections `` Lists names of collections available on this database.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of String

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### List Indexes `` Lists existent indexes in a collection.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of Index

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Map Reduce `` Transforms a collection into a collection of aggregated groups, as follows: 1. Applies a supplied element-mapping function to each element, which transforms each element into a key-value pair. 2. Groups the resulting pairs by key. 3. Reduces values in each group by applying a supplied 'reduce' function coded in JavaScript. Refer to the MongoDB documentation for more information.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to map and reduce.

x

Mapping Function

String

JavaScript-encoded mapping function.

x

Reduce Function

String

JavaScript-encoded reducing function.

x

Output Collection

String

Name of the output collection to which to write the results. This replaces an existing collection, if any exists. This field is mandatory if the resulting objects are larger than 16 MB. If Output Collection is unspecified, the computation is performed in-memory and is not persisted.

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Binary

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Remove Documents `` Removes all the documents that match the specified query. If a query is not specified, all documents are removed. It is more efficient to drop a connection and re-create it than to use this operation.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Collection for which to remove elements.

x

Query

Binary

Query for detecting the elements to delete. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Number

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Remove Files `` Removes the file that matches the given file ID. If no file ID is specified, all files are removed.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

File Id

Binary

ID of the file to delete.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Restore From Directory `` Takes the output from the **Dump** operation, restores the output, and generates indexes. This operation inserts records only when the IDs do not already exist in the database.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Input Path

String

Input path of the dump files. This path must be a directory.

x

Drop Collections

Boolean

Indicates whether to drop existing collections before performing the restore.

false

Oplog Replay

Boolean

Replay oplog used for point-in-time restore.

false

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Restore From File `` Restores a single .bson file or a zip file.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to restore.

x

Input

Binary

InputStream that points to the dump file. It can be a .bson file or a zip file.

#[payload]

Drop Collection

Boolean

Indicates whether to drop existing collections before performing the restore.

false

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ### Update Documents `` Updates documents that match the specified query. If a query is not specified, all documents are retrieved. If the multi parameter is set to `false`, only the first document matching the query is updated. Otherwise, all documents matching the query are updated.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Collection Name

String

Name of the collection to update.

x

Query

Binary

Query for detecting the element to update. Values can be {"field1": "value1"} or can contain operators {"field1": {$gte: 1, $lt: 10}}.

Content To Update

Binary

Object to replace the document that matches the query.

#[payload]

Multiple Update

Boolean

Indicates whether only the first document matching the query is updated.

false

Upsert

Boolean

If set to true, creates a new document when no document matches the query criteria. The default value is false, which does not insert a new document when no match is found.

false

Write Concern Acknowledgement

String

Level of acknowledgment requested from MongoDB for write operations propagated to the specified number of MongoDB instances. You can specify a number of instances, for example, n>0, or use a value from the list.

Write Concern Timeout

Number

Specifies a time limit, in milliseconds, for Write Concern Acknowledgement. The value must be greater than 1.

Write Concern Timeout Timeunit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Write Concern Timeout field.

SECONDS

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Any

#### Associated Configurations - [Configuration](#config) #### Throws - MONGO:DUPLICATE\_ERROR - MONGO:CONSISTENCY\_ERROR - MONGO:RETRY\_EXHAUSTED - MONGO:NOT\_FOUND - MONGO:PERMISSIONS\_DENIED - MONGO:TIMEOUT - MONGO:INVALID\_INPUT - MONGO:CONNECTIVITY ## Object Types - [Bulk Item](#BulkItem) - [Bulk Operation Result](#BulkOperationResult) - [Crl File](#crl-file) - [Custom Ocsp Responder](#custom-ocsp-responder) - [Expiration Policy](#ExpirationPolicy) - [Index](#Index) - [Key Store](#KeyStore) - [Read Preference Tag](#ReadPreferenceTag) - [Reconnect](#reconnect) - [Reconnect Forever](#reconnect-forever) - [Reconnection](#Reconnection) - [Redelivery Policy](#RedeliveryPolicy) - [Repeatable File Store Iterable](#repeatable-file-store-iterable) - [Repeatable File Store Stream](#repeatable-file-store-stream) - [Repeatable In Memory Iterable](#repeatable-in-memory-iterable) - [Repeatable In Memory Stream](#repeatable-in-memory-stream) - [Server Address](#ServerAddress) - [Standard Revocation Check](#standard-revocation-check) - [Tls](#Tls) - [Trust Store](#TrustStore) ### Bulk Item Bulk item type.
FieldTypeDescriptionDefault ValueRequired

Exception

Any

Exception.

Id

Any

ID.

Message

String

Message.

Payload

Binary

Payload.

Status Code

String

Status code.

Successful

Boolean

Indicates success.

### Bulk Operation Result Bulk operation result type.
FieldTypeDescriptionDefault ValueRequired

Id

Any

ID.

Items

Array of Bulk Item

Array of items.

Successful

Boolean

Indicates success.

### Crl File Specifies the location of the certification revocation list (CRL) file.
FieldTypeDescriptionDefault ValueRequired

Path

String

Path to the CRL file.

### Custom Ocsp Responder Configures a custom OCSP responder for certification revocation checks.
FieldTypeDescriptionDefault ValueRequired

Url

String

URL of the OCSP responder.

Cert Alias

String

Alias of the signing certificate for the OCSP response. If specified, the alias must be in the truststore.

### Expiration Policy Configures an expiration policy strategy.
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Idle Time field.

### Index Index type.
FieldTypeDescriptionDefault ValueRequired

Field Name

String

Field name.

Name

String

Name of the index.

Order

Enumeration, one of:

  • ASC

  • DESC

Order of the index.

### Key Store Configures the keystore for the TLS protocol. The keystore you generate contains a private key and a public certificate.
FieldTypeDescriptionDefault ValueRequired

Path

String

Path to the keystore. Mule resolves the path relative to the current classpath and file system.

Type

String

Type of keystore.

Alias

String

Alias of the key to use when the keystore contains multiple private keys. By default, Mule uses the first key in the file.

Key Password

String

Password used to protect the private key.

Password

String

Password used to protect the keystore.

Algorithm

String

Encryption algorithm that the keystore uses.

### Read Preference Tag Read preference tag type.
FieldTypeDescriptionDefault ValueRequired

Name Value

Object

Name value.

x

### Reconnect Configures a standard reconnection strategy, which specifies how often to reconnect and how many reconnection attempts the connector source or operation can make.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

Count

Number

How many reconnection attempts the Mule app can make.

### Reconnect Forever Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

### Reconnection Configures a reconnection strategy for an operation.
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

What to do if, when an app is deployed, a connectivity test does not pass after exhausting the associated reconnection strategy:

  • true

    Allow the deployment to fail.

  • false

    Ignore the results of the connectivity test.

Reconnection Strategy

Reconnection strategy to use.

### Redelivery Policy Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.

Message Digest Algorithm

String

Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned.

Id Expression

String

One or more expressions that determine if a message is redelivered. This property can be set only if the Use Secure Hash field is false.

Object Store

ObjectStore

Configures the object store that stores the redelivery counter for each message.

### Repeatable File Store Iterable Repeatable file store iterable type.
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

Maximum amount of instances to keep in memory. If more than that is required, content on the disk is buffered.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Repeatable File Store Stream Configures the repeatable file-store streaming strategy by which Mule keeps a portion of the stream content in memory. If the stream content is larger than the configured buffer size, Mule backs up the buffer’s content to disk and then clears the memory.
FieldTypeDescriptionDefault ValueRequired

In Memory Size

Number

Maximum amount of memory that the stream can use for data. If the amount of memory exceeds this value, Mule buffers the content to disk. To optimize performance:

  • Configure a larger buffer size to avoid the number of times Mule needs to write the buffer on disk. This increases performance, but it also limits the number of concurrent requests your application can process, because it requires additional memory.

  • Configure a smaller buffer size to decrease memory load at the expense of response time.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Repeatable In Memory Iterable Repeatable in memory iterable type.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Amount of instances to initially keep in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the Buffer Size Increment attribute, with an upper limit of Max In Memory Size. Default value is 100 instances.

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower means that the buffer must not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full. Default value is 100 instances.

Max Buffer Size

Number

Maximum amount of memory to use. If more than that is used, a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to 0 means no limit.

### Repeatable In Memory Stream Configures the in-memory streaming strategy by which the request fails if the data exceeds the MAX buffer size. Always run performance tests to find the optimal buffer size for your specific use case.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Initial amount of memory to allocate to the data stream. If the streamed data exceeds this value, the buffer expands by Buffer Size Increment, with an upper limit of Max In Memory Size value.

Buffer Size Increment

Number

Amount by which the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower specifies that the buffer can’t expand.

Max Buffer Size

Number

The maximum amount of memory to use. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to zero means no limit.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the Initial Buffer Size, Buffer Size Increment, and Buffer Unit fields.

### Server Address Server address type.
FieldTypeDescriptionDefault ValueRequired

Host

String

Host to which you want to connect.

x

Port

Number

Port of the host to which you want to connect.

27017

### Proxy Config Configures an HTTP proxy for the OAuth token requests to the identity provider.
FieldTypeDescriptionDefault ValueRequired

Host

String

Hostname or IP address of the proxy server.

x

Port

Number

Port of the proxy server.

x

Username

String

Username to authenticate against the proxy server.

Password

String

Password to authenticate against the proxy server.

Non Proxy Hosts

String

Comma-separated list of hosts that the connector must not route through the proxy.

### Standard Revocation Check Configures standard revocation checks for TLS certificates.
FieldTypeDescriptionDefault ValueRequired

Only End Entities

Boolean

Which elements to verify in the certificate chain:

  • true

    Verify only the last element in the certificate chain.

  • false

    Verify all elements in the certificate chain.

Prefer Crls

Boolean

How to check certificate validity:

  • true

    Check the Certification Revocation List (CRL) for certificate validity.

  • false

    Use the Online Certificate Status Protocol (OCSP) to check certificate validity.

No Fallback

Boolean

Whether to use the secondary method to check certificate validity:

  • true

    Use the method that wasn’t specified in the Prefer Crls field (the secondary method) to check certificate validity.

  • false

    Do not use the secondary method to check certificate validity.

Soft Fail

Boolean

What to do if the revocation server can’t be reached or is busy:

  • true

    Avoid verification failure.

  • false

    Allow the verification to fail.

### Tls Configures TLS to provide secure communications for the Mule app.
FieldTypeDescriptionDefault ValueRequired

Enabled Protocols

String

Comma-separated list of protocols enabled for this context.

Enabled Cipher Suites

String

Comma-separated list of cipher suites enabled for this context.

Trust Store

Configures the TLS truststore.

Key Store

Configures the TLS keystore.

Revocation Check

Configures a revocation checking mechanism.

### Trust Store Configures the truststore for TLS.
FieldTypeDescriptionDefault ValueRequired

Path

String

Path to the truststore. Mule resolves the path relative to the current classpath and file system.

Password

String

Password used to protect the truststore.

Type

String

Type of truststore.

Algorithm

String

Encryption algorithm that the truststore uses.

Insecure

Boolean

If true, Mule stops performing certificate validations. Setting this to true can make connections vulnerable to attacks.

## System Properties You can configure this system property for the MongoDB Connector:
PropertyDefaultDescription

com.mulesoft.connector.mongo.skipIsoCoercionUnderOperatorKeys

false

When set to true, ISO-8601 strings nested under MongoDB query operator keys (keys prefixed with $, such as $match, $and, $or, $elemMatch, $expr, and $lte) are passed through verbatim as strings instead of being auto-coerced to BSON Date values. Use this property only if you query String-typed date fields through operator expressions and the queries return empty results unexpectedly.

> [!NOTE] This system property applies JVM-wide to all MongoDB Connector configurations and > operations, and takes effect only after a Mule app restart. > > If your app relies on ISO-8601 auto-coercion for fields that store genuine BSON Date values, use > Extended JSON notation (`{"$date": "…​"}`) or DataWeave date types instead of enabling this > property. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.4 is-latest-version: true --- # MongoDB Connector 6.4 XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt If you manually code a Mule app in XML either from the Anypoint Studio XML editor or from a text editor, you can get access to Anypoint Connector for MongoDB (MongoDB Connector) in your app by adding reference statements to your XML Mule flow and in the Apache Maven `pom.xml` file. You can avoid the manual process described in this topic by using Studio. When you install MongoDB Connector in Studio, Studio automatically populates the XML code with the MongoDB Connector namespace and schema location, and adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/mongodb http://www.mulesoft.org/schema/mule/mongodb/current/mule-mongo.xsd ``` This example shows how the namespace statements are placed in the XML block: ```xml ``` ## Add a POM File Dependency The `pom.xml` Maven file generated by Studio contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.connectors mule-mongodb-connector 6.x.x mule-plugin ``` To obtain the most up-to-date `pom.xml` file information, access the connector in [Anypoint Exchange](https://www.mulesoft.com/exchange/) and click **Dependency Snippets**. Replace `6.x.x` in the `` element with your MongoDB version. ## Next Steps After completing your namespace and `pom.xml` file, you can try the MongoDB [Examples](https://docs.mulesoft.com/mongodb-connector/latest/mongodb-connector-examples). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.3 --- # MongoDB Connector Additional Configuration Information > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Additional Results in the Response of the Execute Command Operation The **Execute Command** operation returns one page of results. If an execution returns a cursor reference, invoke the `getMore` command as needed to traverse subsequent pages of results. Suppose `executeCommand` is invoked with the following command value: ```dataweave { "find": ("test"), "skip": 0, "batchSize": 10 } ``` The `executeCommand` returns a result like this: ```dataweave { "cursor": { "firstBatch": [ { "_id": { "$oid": "..." }, "meta": { "view": { "id": 1, // ... } // ,{ ... }, ... } //.... } ], "id": 9041685167132828464, "ns": "test.test" }, "ok": 1.0 } ``` To get additional results until there are none left, use the [`getMore` command](https://www.mongodb.com/docs/v4.4/reference/command/getmore/) to retrieve the next page of results: ```dataweave { "getMore": 9041685167132828464, "collection" : "test", "batchSize": 10 } ``` The results of the `getMore` command include a cursor ID to use in subsequent `getMore` commands. ## See Also [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.4 is-latest-version: true --- # MongoDB Connector Additional Configuration Information > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Additional Results in the Response of the Execute Command Operation The **Execute Command** operation returns one page of results. If an execution returns a cursor reference, invoke the `getMore` command as needed to traverse subsequent pages of results. Suppose `executeCommand` is invoked with the following command value: ```dataweave { "find": ("test"), "skip": 0, "batchSize": 10 } ``` The `executeCommand` returns a result like this: ```dataweave { "cursor": { "firstBatch": [ { "_id": { "$oid": "..." }, "meta": { "view": { "id": 1, // ... } // ,{ ... }, ... } //.... } ], "id": 9041685167132828464, "ns": "test.test" }, "ok": 1.0 } ``` To get additional results until there are none left, use the [`getMore` command](https://www.mongodb.com/docs/v4.4/reference/command/getmore/) to retrieve the next page of results: ```dataweave { "getMore": 9041685167132828464, "collection" : "test", "batchSize": 10 } ``` The results of the `getMore` command include a cursor ID to use in subsequent `getMore` commands. ## See Also [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.3 --- # Troubleshooting MongoDB Connector 6.3 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To troubleshoot Anypoint Connector for MongoDB (MongoDB Connector), become familiar with the information about interpreting commonly thrown exception messages. ## Enable SSL Logging Enable SSL logs to investigate an issue related to TLS communications. Set your SSL log level depending on your required level of detail: 1. Enable only SSL log details: `javax.net.debug=ssl` 2. Enable only handshaking details. (The handshake protocol is a series of messages exchanged over the record protocol.) `javax.net.debug=ssl:handshake` 3. Enable handshaking details and SSL details at the same time: `javax.net.debug=ssl, handshake` 4. Enable the dumping of all details and traffic data: `javax.net.debug=all` > [!NOTE] This option is very verbose and under normal circumstances is not necessary. > [!WARNING] SSL logging results in a performance impact for HTTPS or other TLS connections. Enable > SSL logging only to troubleshoot a specific issue and do not enable it for extended periods. SSL > logging produces a significant amount of log messages and can inundate your log file if it is left > enabled and unattended. To enable SSL logs: Set the debug parameter as an argument in the runtime configuration for the application. 1. In Studio, right-click on the project and select **Run > Run Configurations**. 2. Go to the **Arguments** tab and add `-M-Djavax.net.debug=ssl` in the **VM arguments** section. ## Enable Verbose Exception Logging Enable verbose exception logs to show a complete stack trace of the error instead of the default truncated output: 1. In Studio, right-click on the project and select **Run > Run Configurations**. 2. Go to the **Arguments** tab and append the arguments in the **VM arguments** section to add the `mule.verbose.exceptions` property. For example: `-XX:PermSize=128M -XX:MaxPermSize=256M -Dmule.verbose.exceptions=true` ## Enable Verbose Logging To get a better understanding of why an application’s interaction with MongoDB Connector is failing, temporarily enable verbose logging for the connector. Remember to always disable enhanced verbosity after troubleshooting, because it can affect your Mule application’s performance. To enable verbose logging in the configuration file: 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` folder. 4. Open the `log4j2.xml` file inside the folder. 5. Add an `` tag inside the `` tag: ```xml ... ... ``` 6. Save your application changes. 7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule Application**. ## Understand Commonly Thrown Exceptions Here is a list of commonly thrown exception messages and how to interpret them: - MONGO:CONNECTIVITY Either a connection could not be established or there is a connectivity error. - MONGO:CONSISTENCY\_ERROR The data is not consistent because the client cannot find a read after performing a write. - MONGO:DUPLICATE\_ERROR There is a duplicate key. - MONGO:INVALID\_INPUT The provided input data for an operation is not valid. - MONGO:NOT\_FOUND The server could not find the requested resource. - MONGO:PERMISSIONS\_DENIED A permission error occurred while accessing a collection in a database. - MONGO:RETRY\_EXHAUSTED The maximum number of retries for the operation is reached. - MONGO:TIMEOUT A specific request takes longer than the configuration timeout values. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [MongoDB Connector Reference](https://docs.mulesoft.com/mongodb-connector/6.3/mongodb-connector-reference) - [Salesforce Help](https://help.salesforce.com) - [Known Issues](https://help.salesforce.com/s/issues) --- product: MongoDB Connector version: 6.4 is-latest-version: true --- # Troubleshooting MongoDB Connector 6.4 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To troubleshoot Anypoint Connector for MongoDB (MongoDB Connector), become familiar with the information about interpreting commonly thrown exception messages. ## Enable SSL Logging Enable SSL logs to investigate an issue related to TLS communications. Set your SSL log level depending on your required level of detail: 1. Enable only SSL log details: `javax.net.debug=ssl` 2. Enable only handshaking details. (The handshake protocol is a series of messages exchanged over the record protocol.) `javax.net.debug=ssl:handshake` 3. Enable handshaking details and SSL details at the same time: `javax.net.debug=ssl, handshake` 4. Enable the dumping of all details and traffic data: `javax.net.debug=all` > [!NOTE] This option is very verbose and under normal circumstances is not necessary. > [!WARNING] SSL logging results in a performance impact for HTTPS or other TLS connections. Enable > SSL logging only to troubleshoot a specific issue and do not enable it for extended periods. SSL > logging produces a significant amount of log messages and can inundate your log file if it is left > enabled and unattended. To enable SSL logs: Set the debug parameter as an argument in the runtime configuration for the application. 1. In Studio, right-click on the project and select **Run > Run Configurations**. 2. Go to the **Arguments** tab and add `-M-Djavax.net.debug=ssl` in the **VM arguments** section. ## Enable Verbose Exception Logging Enable verbose exception logs to show a complete stack trace of the error instead of the default truncated output: 1. In Studio, right-click on the project and select **Run > Run Configurations**. 2. Go to the **Arguments** tab and append the arguments in the **VM arguments** section to add the `mule.verbose.exceptions` property. For example: `-XX:PermSize=128M -XX:MaxPermSize=256M -Dmule.verbose.exceptions=true` ## Enable Verbose Logging To get a better understanding of why an application’s interaction with MongoDB Connector is failing, temporarily enable verbose logging for the connector. Remember to always disable enhanced verbosity after troubleshooting, because it can affect your Mule application’s performance. To enable verbose logging in the configuration file: 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` folder. 4. Open the `log4j2.xml` file inside the folder. 5. Add an `` tag inside the `` tag: ```xml ... ... ``` 6. Save your application changes. 7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule Application**. ## Understand Commonly Thrown Exceptions Here is a list of commonly thrown exception messages and how to interpret them: - MONGO:CONNECTIVITY Either a connection could not be established or there is a connectivity error. - MONGO:CONSISTENCY\_ERROR The data is not consistent because the client cannot find a read after performing a write. - MONGO:DUPLICATE\_ERROR There is a duplicate key. - MONGO:INVALID\_INPUT The provided input data for an operation is not valid. - MONGO:NOT\_FOUND The server could not find the requested resource. - MONGO:PERMISSIONS\_DENIED A permission error occurred while accessing a collection in a database. - MONGO:RETRY\_EXHAUSTED The maximum number of retries for the operation is reached. - MONGO:TIMEOUT A specific request takes longer than the configuration timeout values. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [MongoDB Connector Reference](https://docs.mulesoft.com/mongodb-connector/latest/mongodb-connector-reference) - [Salesforce Help](https://help.salesforce.com) - [Known Issues](https://help.salesforce.com/s/issues) --- product: MongoDB Connector version: 6.3 --- # Upgrading and Migrating MongoDB Connector to version 6.x > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Supported Upgrade Paths
From VersionTo Version

5.3.x

6.x.x

## Changes in This Release MongoDB 6.x.x contains the following changes: - Changed connection types and configuration - Changed operation names, metadata, fields, and values - Changed input sources - Added the ability to specify which MongoDB Java driver to use - At runtime, you can overwrite the **Write concern acknowledgement** and **Write concern timeout** fields in the global element of the following operations: - Find documents - Insert document - Insert documents - Update Documents - Count documents operations ### Changes in Connection Types and Configuration MongoDB 6.x contains the following changes to connection types and configuration: - Removed the Connection String connection type (reintroduced in 6.3.0 version to support MongoDB Atlas) - Removed the Metadata configuration section MongoDB automatically generates the metadata. #### Config Advanced Tab The following optional changes apply to the **Advanced** tab in the global configuration: - Added the following read concern options: - Read concern: Enables the control of the consistency and isolation properties of the data read from replica sets and replica set shards. - Read preference: Specifies the read preferences for this connection. - Maximum staleness seconds: Specifies how stale a secondary MongoDB cluster can be before the client stops using it for read operations. A value of -1 means that there is no maximum staleness threshold. - Read preference tags: Enables you to specify a tag set in the read preference to target those members associated with a tag in the set. - Added the following write concern options: - Write concern acknowledgment: Requests an acknowledgment that the write operation was propagated to the specified number of instances. - Write concern timeout: Specifies a time limit for the write concern. - Write concern timeout timeunit: Specifies a time unit for the Write concern timeout field. #### Connection Section The following changes apply to the tabs in the **Connection** section of the global configuration: - Added the following fields to the General tab: - Required Libraries: Reference to the MongoDB Driver.The version must be 3.11 or later. - Server Addresses: This field is now is a list of server addresses to use for the connection. - Added a Security tab for optional TLS context configuration. - Added the following optional fields to the Advanced tab: - Authentication mechanism: Authentication mechanism used for this connection - Replica set name: Name of the replica set to which to connect - Authentication source: Database name associated with the user’s credentials - Compressors: List of compressors for which to enable network compression for communication between this client and a mongod/mongos instance - Zlib compression level: Integer that specifies the compression level if using zlib for network compression. Set this field to 0 for no compression or from 1 through 9 for compression, with 1 being the lowest compression level and 9 the highest. High compression levels require more processing time than low compression levels. - Connection timeout: Connection timeout used when establishing the socket connections - Connection timeout time unit: Time unit for the Connection timeout field - Local threshold: Size of the latency window for selecting among multiple suitable MongoDB instances - Local threshold time unit: Time unit for the Local threshold time unit field - Server selection timeout: How long to block for server selection before throwing an exception - Server selection timeout time unit: Time unit for the Server selection timeout field - Socket timeout: Maximum time to wait for a send or receive operation on a socket before the attempt times out - Socket timeout unit: Time unit for the Socket timeout field - Min connection pool size: Minimum size for the connection pool - Max connection pool size: Maximum size for the connection pool - Max wait queue time: Maximum wait queue time for the connection pool - Max wait queue time unit: Time unit for the Maximum wait queue time field - Max connection life time: Maximum connection lifetime for the connection pool - Max connection life time time unit: Time unit for the Maximum connection life time field - Max connection idle time: Maximum connection idle time for the connection pool - Max connection idle time unit: Time unit for the Maximum connection idle time field ## Changed Operations, Parameters, and Return Types The following table shows changes to operation names, input parameters, and return types:
MongoDB 5.x OperationChanges in MongoDB 6.0

Count documents

Input parameters are now:

  • Collection name (String)

  • Query (JSON)

Return type is now Long with the count result.

Create Collection

Input parameters are now:

  • Collection name (String)

  • Max objects (Integer)

  • Collection size (Integer)

  • Collection size data unit (TimeUnit)

Exists collection

Operation is now called Collection exists.

Create file from payload

  • Operation is now called Create file.

  • Return type is now JSON.

Create index

Input parameters are now:

  • Collection name (String)

  • Field name (String)

  • Sort order (Enum: ASC or DESC)

Dump

Input parameters are now:

  • Output directory (String)

  • Output name prefix (String)

  • Oplog (no change)

  • Operation timeout (Integer)

  • Operation timeout unit (TimeUnit)

Return type is now a List<String> type that points to the created files. Each string is a filePath type.

Execute command

  • Input parameter is Command (JSON).

  • Return type is now a JSON type that contains the result of the command.

Find documents

Input parameters are now:

  • Collection name (String)

  • Query (JSON)

  • Fields (String)

  • Sort by (JSON)

  • Page size (Integer)

  • Limit (Integer)

This operation supports pagination. Each item returned as a JSON type.

Find files

  • Input parameters are now:

    • Query (JSON)

    • Sort (JSON)

  • Return type is now a JSON list.

Get file content

  • Input parameter is now File id (JSON).

  • Return type is now a stream with the binary file content. This operation also returns the file information as attributes.

Insert document

Return type is now an entire JSON object with the _id object of the created document.

Insert documents

Return type is now a Bulk Operation Result, which contains a JSON file that lists each created record and its status.

List collections

Return type is now a List<String> type that contains the names of the collections.

List indices

Operation is now called List indexes.

Map reduce objects

  • Operation is now called Map reduce.

  • Return type is now a JSON type that represents the output specified in the reduce function.

Remove documents

  • Input parameters are now:

    • Collection name (String)

    • Query (JSON)

  • Return type is now a Long with the count result.

Remove files

Input parameter is now File id (JSON).

Update documents

  • Input parameters are now:

    • Collection name (String)

    • Query (JSON)

    • Content to update (JSON)

    • Multiple update (Boolean: moved to the Advanced tab)

    • Upsert (Boolean)

  • Return type is now a JSON type that contains the following structure:

    • Int Matched

    • Int Modified

    • String Upserted Id

## Changed Operations Metadata MongoDB 5.x generated operations metadata when the user provided a set of documents per collection from which to take the attributes. MongoDB 6.0 generates metadata automatically, based on the latest document in each collection. ### Metadata in MongoDB v6.0
Operation NameInput MetadataOutput Metadata

Insert Document

Document

Resolved dynamically based on the selected value of the collection parameter. The connector adds the latest document of the given collection and uses the document’s structure as input/output metadata.

Insert Documents

Document

Resolved dynamically based on the selected value of the collection parameter. The connector adds the latest document of the given collection and uses the document’s structure as input/output metadata.

Update Documents

Not applicable

JSON that contains the following structure:

  • Int Matched

  • Int Modified

  • JSON upsertedId

Remove Documents

Query: JSON Object

Not applicable

Count Documents

Query: JSON Object

Not applicable

Find Documents

Query: JSON Object

Resolved dynamically based on the selected value of the collection parameter. The connector uses the structure of the last document in the given collection.

Create File

Not applicable

A JSON object with the following attributes:

  • JSON Id

  • String fileName

  • Long Length

  • Int ChunkSize

  • Datetime uploadDate

  • JSON Metadata

Find Files

Not applicable

List of JSON objects with the following attributes:

  • JSON Id

  • String fileName

  • Long Length

  • Int ChunkSize

  • Datetime uploadDate

  • JSON Metadata

## Removed Operations The following operations were removed from the MongoDB connector:
Removed from MongoDB 5.xCan be reproduced in MongoDB 6.0.0 through

Name

Description

Name

Description

Incremental dump

Executes an incremental dump of the database

Dump

Use the Dump operation.

Restore

Takes the output from the dump and restores it

Restore from file or Restore from directory

Restore from file or Restore from directory take the output from the dump file or directory and restore it.

Update documents by function

Update documents using a Mongo function

Not applicable

Not applicable

Update documents by functions

Update documents using one or more Mongo functions

Not applicable

Not applicable

Find one and update document

Finds and updates the first document that matches a given query

Not applicable

This operation’s functionality can be reproduced by combining other operations.

For example, you can invoke the Find documents operation with a limit of 1 document. Then you can invoke the Update documents operation using the ID of the document returned previously.

Save document

Inserts or updates a document based on its object ID

Not applicable

Not applicable

Find one document

Finds the first document that matches a given query

Find documents

Set the Limit=1 to return one document.

Execute generic command

Executes a generic command on the database

Execute command

Executes a command on the database

List files

Lists all files that match the given query and sorts them by filename

Not applicable

Not applicable

Find one file

Returns the first file that matches the given query

Find files

Specify a specific file to query

## Removed Parameters The **Num To Skip** field in the **Find Documents** operation is removed from MongoDB Connector 6.x. The `skip()` method in MongoDB, which is used internally by the **Num To Skip** field, can lead to performance issues, especially as the offset increases. This is because the server scans through the results from the beginning to the specified offset before returning any documents, which adds unnecessary load and slows down the operation. To optimize pagination and improve performance when migrating to MongoDB Connector 6.x, the following approaches are recommended: - Avoid using `skip()` for large offsets. Instead of using the **Num To Skip** field, it is more efficient to refine query conditions to exclude unwanted documents directly. - Use range queries. Use existing indexes to perform range queries. For example, if your documents have a timestamp or a unique ID field (indexed), you can use these fields to filter results directly to avoid scanning through unwanted documents. ```json { "timestamp": { "$gt": ISODate("2024-01-01T00:00:00Z") } } ``` - Apply `limit()` for pagination. Use the `limit()` method in combination with range queries to control the number of documents returned, effectively implementing pagination without the performance issues associated with `skip()`. ```json { "timestamp": { "$gt": ISODate("2024-01-01T00:00:00Z") } } .limit(10) ``` - Combine filters and sorting. Consider ordering documents by an indexed field, which allows for more efficient queries when paginating through results. ## Changes in Input Sources MongoDB 6.0.0 has one input source, Object Listener, which retrieves all of the created documents that belong to a specific collection. The Delete Sources and Update Sources input sources were removed. ### Metadata in Object Listener
Input MetadataOutput Metadata

Not applicable

The connector resolves output metadata dynamically based on the selected value of the Collection Name parameter. The connector reads the last document of the given collection and uses the document’s structure as output metadata.

## Requirements and Limitations
SoftwareVersion

Mule

4.1.1 and later

MongoDB

MongoDB Java driver 3.11 and later

## Upgrade Prerequisites Before you perform the upgrade, you must: 1. Create a backup of your files, data, and configuration in case you need to restore to the previous version. 2. Install MongoDB v6.0 to replace the MongoDB operations that were previously included in MongoDB Connector v5.x. ## Upgrade Steps Follow these steps to perform the upgrade from MongoDB Connector v5.3.x to MongoDB Connector v6.0: 1. In Anypoint Studio, create a Mule project. 2. In the Mule Palette view, click **Search in Exchange**. 3. In the **Add Dependencies to Project** window, enter `MongoDB` in the search field. 4. In the **Available modules** section, select **MongoDB Connector** and click **Add**. 5. Click **Finish**. 6. Verify that the salesforce-connector dependency version is 6.0.0 in the `pom.xml` file in the Mule project. Studio upgrades the connector automatically. ## Verify the Upgrade After you install the latest version of the connector, follow these steps to verify the upgrade: 1. In Studio, verify that there are no errors in the **Problems** or **Console** views. 2. Check the project `pom.xml` file and verify that there are no problems. 3. Test the connection and verify that the operations work. ## Troubleshooting If there are problems with caching the parameters and metadata, try restarting Studio. ## Revert the Upgrade If it is necessary to revert to the previous version of MongoDB Connector, change the mule-mongodb-connector dependency version 6.0.0 in the project’s `pom.xml` to the previous version. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.4 is-latest-version: true --- # Upgrading and Migrating MongoDB Connector to version 6.x > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Upgrade Anypoint Connector for MongoDB (MongoDB Connector) from version 5.3.x to version 6.x.x. ## Supported Upgrade Paths
From VersionTo Version

5.3.x

6.x.x

## Changes in This Release MongoDB 6.x.x contains the following changes: - Changed connection types and configuration - Changed operation names, metadata, fields, and values - Changed input sources - Added the ability to specify which MongoDB Java driver to use - At runtime, you can overwrite the **Write concern acknowledgement** and **Write concern timeout** fields in the global element of the following operations: - Find documents - Insert document - Insert documents - Update Documents - Count documents operations ### Changes in Connection Types and Configuration MongoDB 6.x contains the following changes to connection types and configuration: - Removed the Connection String connection type (reintroduced in 6.3.0 version to support MongoDB Atlas) - Removed the Metadata configuration section MongoDB automatically generates the metadata. #### Config Advanced Tab The following optional changes apply to the **Advanced** tab in the global configuration: - Added the following read concern options: - Read concern: Enables the control of the consistency and isolation properties of the data read from replica sets and replica set shards. - Read preference: Specifies the read preferences for this connection. - Maximum staleness seconds: Specifies how stale a secondary MongoDB cluster can be before the client stops using it for read operations. A value of -1 means that there is no maximum staleness threshold. - Read preference tags: Enables you to specify a tag set in the read preference to target those members associated with a tag in the set. - Added the following write concern options: - Write concern acknowledgment: Requests an acknowledgment that the write operation was propagated to the specified number of instances. - Write concern timeout: Specifies a time limit for the write concern. - Write concern timeout timeunit: Specifies a time unit for the Write concern timeout field. #### Connection Section The following changes apply to the tabs in the **Connection** section of the global configuration: - Added the following fields to the General tab: - Required Libraries: Reference to the MongoDB Driver.The version must be 3.11 or later. - Server Addresses: This field is now is a list of server addresses to use for the connection. - Added a Security tab for optional TLS context configuration. - Added the following optional fields to the Advanced tab: - Authentication mechanism: Authentication mechanism used for this connection - Replica set name: Name of the replica set to which to connect - Authentication source: Database name associated with the user’s credentials - Compressors: List of compressors for which to enable network compression for communication between this client and a mongod/mongos instance - Zlib compression level: Integer that specifies the compression level if using zlib for network compression. Set this field to 0 for no compression or from 1 through 9 for compression, with 1 being the lowest compression level and 9 the highest. High compression levels require more processing time than low compression levels. - Connection timeout: Connection timeout used when establishing the socket connections - Connection timeout time unit: Time unit for the Connection timeout field - Local threshold: Size of the latency window for selecting among multiple suitable MongoDB instances - Local threshold time unit: Time unit for the Local threshold time unit field - Server selection timeout: How long to block for server selection before throwing an exception - Server selection timeout time unit: Time unit for the Server selection timeout field - Socket timeout: Maximum time to wait for a send or receive operation on a socket before the attempt times out - Socket timeout unit: Time unit for the Socket timeout field - Min connection pool size: Minimum size for the connection pool - Max connection pool size: Maximum size for the connection pool - Max wait queue time: Maximum wait queue time for the connection pool - Max wait queue time unit: Time unit for the Maximum wait queue time field - Max connection life time: Maximum connection lifetime for the connection pool - Max connection life time time unit: Time unit for the Maximum connection life time field - Max connection idle time: Maximum connection idle time for the connection pool - Max connection idle time unit: Time unit for the Maximum connection idle time field ## Changed Operations, Parameters, and Return Types The following table shows changes to operation names, input parameters, and return types:
MongoDB 5.x OperationChanges in MongoDB 6.0

Count documents

Input parameters are now:

  • Collection name (String)

  • Query (JSON)

Return type is now Long with the count result.

Create Collection

Input parameters are now:

  • Collection name (String)

  • Max objects (Integer)

  • Collection size (Integer)

  • Collection size data unit (TimeUnit)

Exists collection

Operation is now called Collection exists.

Create file from payload

  • Operation is now called Create file.

  • Return type is now JSON.

Create index

Input parameters are now:

  • Collection name (String)

  • Field name (String)

  • Sort order (Enum: ASC or DESC)

Dump

Input parameters are now:

  • Output directory (String)

  • Output name prefix (String)

  • Oplog (no change)

  • Operation timeout (Integer)

  • Operation timeout unit (TimeUnit)

Return type is now a List<String> type that points to the created files. Each string is a filePath type.

Execute command

  • Input parameter is Command (JSON).

  • Return type is now a JSON type that contains the result of the command.

Find documents

Input parameters are now:

  • Collection name (String)

  • Query (JSON)

  • Fields (String)

  • Sort by (JSON)

  • Page size (Integer)

  • Limit (Integer)

This operation supports pagination. Each item returned as a JSON type.

Find files

  • Input parameters are now:

    • Query (JSON)

    • Sort (JSON)

  • Return type is now a JSON list.

Get file content

  • Input parameter is now File id (JSON).

  • Return type is now a stream with the binary file content. This operation also returns the file information as attributes.

Insert document

Return type is now an entire JSON object with the _id object of the created document.

Insert documents

Return type is now a Bulk Operation Result, which contains a JSON file that lists each created record and its status.

List collections

Return type is now a List<String> type that contains the names of the collections.

List indices

Operation is now called List indexes.

Map reduce objects

  • Operation is now called Map reduce.

  • Return type is now a JSON type that represents the output specified in the reduce function.

Remove documents

  • Input parameters are now:

    • Collection name (String)

    • Query (JSON)

  • Return type is now a Long with the count result.

Remove files

Input parameter is now File id (JSON).

Update documents

  • Input parameters are now:

    • Collection name (String)

    • Query (JSON)

    • Content to update (JSON)

    • Multiple update (Boolean: moved to the Advanced tab)

    • Upsert (Boolean)

  • Return type is now a JSON type that contains the following structure:

    • Int Matched

    • Int Modified

    • String Upserted Id

## Changed Operations Metadata MongoDB 5.x generated operations metadata when the user provided a set of documents per collection from which to take the attributes. MongoDB 6.0 generates metadata automatically, based on the latest document in each collection. ### Metadata in MongoDB v6.0
Operation NameInput MetadataOutput Metadata

Insert Document

Document

Resolved dynamically based on the selected value of the collection parameter. The connector adds the latest document of the given collection and uses the document’s structure as input/output metadata.

Insert Documents

Document

Resolved dynamically based on the selected value of the collection parameter. The connector adds the latest document of the given collection and uses the document’s structure as input/output metadata.

Update Documents

Not applicable

JSON that contains the following structure:

  • Int Matched

  • Int Modified

  • JSON upsertedId

Remove Documents

Query: JSON Object

Not applicable

Count Documents

Query: JSON Object

Not applicable

Find Documents

Query: JSON Object

Resolved dynamically based on the selected value of the collection parameter. The connector uses the structure of the last document in the given collection.

Create File

Not applicable

A JSON object with the following attributes:

  • JSON Id

  • String fileName

  • Long Length

  • Int ChunkSize

  • Datetime uploadDate

  • JSON Metadata

Find Files

Not applicable

List of JSON objects with the following attributes:

  • JSON Id

  • String fileName

  • Long Length

  • Int ChunkSize

  • Datetime uploadDate

  • JSON Metadata

## Removed Operations The following operations were removed from the MongoDB connector:
Removed from MongoDB 5.xCan be reproduced in MongoDB 6.0.0 through

Name

Description

Name

Description

Incremental dump

Executes an incremental dump of the database

Dump

Use the Dump operation.

Restore

Takes the output from the dump and restores it

Restore from file or Restore from directory

Restore from file or Restore from directory take the output from the dump file or directory and restore it.

Update documents by function

Update documents using a Mongo function

Not applicable

Not applicable

Update documents by functions

Update documents using one or more Mongo functions

Not applicable

Not applicable

Find one and update document

Finds and updates the first document that matches a given query

Not applicable

This operation’s functionality can be reproduced by combining other operations.

For example, you can invoke the Find documents operation with a limit of 1 document. Then you can invoke the Update documents operation using the ID of the document returned previously.

Save document

Inserts or updates a document based on its object ID

Not applicable

Not applicable

Find one document

Finds the first document that matches a given query

Find documents

Set the Limit=1 to return one document.

Execute generic command

Executes a generic command on the database

Execute command

Executes a command on the database

List files

Lists all files that match the given query and sorts them by filename

Not applicable

Not applicable

Find one file

Returns the first file that matches the given query

Find files

Specify a specific file to query

## Removed Parameters The **Num To Skip** field in the **Find Documents** operation is removed from MongoDB Connector 6.x. The `skip()` method in MongoDB, which is used internally by the **Num To Skip** field, can lead to performance issues, especially as the offset increases. This is because the server scans through the results from the beginning to the specified offset before returning any documents, which adds unnecessary load and slows down the operation. To optimize pagination and improve performance when migrating to MongoDB Connector 6.x, the following approaches are recommended: - Avoid using `skip()` for large offsets. Instead of using the **Num To Skip** field, it is more efficient to refine query conditions to exclude unwanted documents directly. - Use range queries. Use existing indexes to perform range queries. For example, if your documents have a timestamp or a unique ID field (indexed), you can use these fields to filter results directly to avoid scanning through unwanted documents. ```json { "timestamp": { "$gt": ISODate("2024-01-01T00:00:00Z") } } ``` - Apply `limit()` for pagination. Use the `limit()` method in combination with range queries to control the number of documents returned, effectively implementing pagination without the performance issues associated with `skip()`. ```json { "timestamp": { "$gt": ISODate("2024-01-01T00:00:00Z") } } .limit(10) ``` - Combine filters and sorting. Consider ordering documents by an indexed field, which allows for more efficient queries when paginating through results. ## Changes in Input Sources MongoDB 6.0.0 has one input source, Object Listener, which retrieves all of the created documents that belong to a specific collection. The Delete Sources and Update Sources input sources were removed. ### Metadata in Object Listener
Input MetadataOutput Metadata

Not applicable

The connector resolves output metadata dynamically based on the selected value of the Collection Name parameter. The connector reads the last document of the given collection and uses the document’s structure as output metadata.

## Requirements and Limitations
SoftwareVersion

Mule

4.1.1 and later

MongoDB

MongoDB Java driver 3.11 and later

## Upgrade Prerequisites Before you perform the upgrade, you must: 1. Create a backup of your files, data, and configuration in case you need to restore to the previous version. 2. Install MongoDB v6.0 to replace the MongoDB operations that were previously included in MongoDB Connector v5.x. ## Upgrade Steps Follow these steps to perform the upgrade from MongoDB Connector v5.3.x to MongoDB Connector v6.0: 1. In Anypoint Studio, create a Mule project. 2. In the Mule Palette view, click **Search in Exchange**. 3. In the **Add Dependencies to Project** window, enter `MongoDB` in the search field. 4. In the **Available modules** section, select **MongoDB Connector** and click **Add**. 5. Click **Finish**. 6. Verify that the salesforce-connector dependency version is 6.0.0 in the `pom.xml` file in the Mule project. Studio upgrades the connector automatically. ## Verify the Upgrade After you install the latest version of the connector, follow these steps to verify the upgrade: 1. In Studio, verify that there are no errors in the **Problems** or **Console** views. 2. Check the project `pom.xml` file and verify that there are no problems. 3. Test the connection and verify that the operations work. ## Troubleshooting If there are problems with caching the parameters and metadata, try restarting Studio. ## Revert the Upgrade If it is necessary to revert to the previous version of MongoDB Connector, change the mule-mongodb-connector dependency version 6.0.0 in the project’s `pom.xml` to the previous version. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.3 --- # Using Anypoint Studio to Configure MongoDB Connector 6.3 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure an input source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). 6. [Configure the other connector fields](#configure-other-fields). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [MongoDB Connector Reference](https://docs.mulesoft.com/mongodb-connector/6.3/mongodb-connector-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In **Add Modules to Project**, type `mongodb` in the search field. 3. Click **MongoDB** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## 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. For example, to configure `HTTP Listener`, follow these steps: 1. In the **Mule Palette** view, select **HTTP** > **Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (+) next to the **Connector configuration** field to configure a global element that can be used by all instances of `HTTP Listener` in the app. 6. On the **General** tab, specify connection information. 7. On the **TLS** tab, optionally specify TLS information. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specific server. 10. Click **OK**. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform. To add an operation for MongoDB, follow these steps: 1. In the **Mule Palette** view, select **MongoDB** and then select the desired operation. 2. Drag the operation onto the Studio canvas to the right of the input source. ## Configure a Global Element for the Connector When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials the connector uses to access the target MongoDB system. To configure the global element for MongoDB Connector, follow these steps: 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. ## Logging 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](https://docs.mulesoft.com/mongodb-connector/6.3/mongodb-connector-examples) topic for more configuration ideas. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: MongoDB Connector version: 6.4 is-latest-version: true --- # Using Anypoint Studio to Configure MongoDB Connector 6.4 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure an input source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). 6. [Configure the other connector fields](#configure-other-fields). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [MongoDB Connector Reference](https://docs.mulesoft.com/mongodb-connector/latest/mongodb-connector-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In **Add Modules to Project**, type `mongodb` in the search field. 3. Click **MongoDB** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## 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. For example, to configure `HTTP Listener`, follow these steps: 1. In the **Mule Palette** view, select **HTTP** > **Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (+) next to the **Connector configuration** field to configure a global element that can be used by all instances of `HTTP Listener` in the app. 6. On the **General** tab, specify connection information. 7. On the **TLS** tab, optionally specify TLS information. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specific server. 10. Click **OK**. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform. To add an operation for MongoDB, follow these steps: 1. In the **Mule Palette** view, select **MongoDB** and then select the desired operation. 2. Drag the operation onto the Studio canvas to the right of the input source. ## Configure a Global Element for the Connector When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials the connector uses to access the target MongoDB system. To configure the global element for MongoDB Connector, follow these steps: 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. ## Logging 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](https://docs.mulesoft.com/mongodb-connector/latest/mongodb-connector-examples) topic for more configuration ideas. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com)