MongoDB Connector 6.2 | MuleSoft Documentation
# MongoDB Connector 6.2
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 Exchange: 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


## Audience
  * New user
To create your Mule app, see Studio Configuration.
  * Advanced user
Read XML and Maven Support and Examples.


## Exchange Example
Anypoint Exchange has an example that shows how to import data in a CSV format from a local directory into MongoDB.
## Important Considerations when Migrating from Mule 3 to Mule 4
When migrating Mule apps that use MongoDB Connector from Mule 3 to Mule 4, consider the following changes in date handling:
  * **Automatic conversion to UTC**
In Mule 3, MongoDB Connector stores dates exactly as they are sent, preserving the original timezone. However, in Mule 4, dates (whether they are sent to or retrieved from MongoDB) are automatically converted to UTC before they are stored in MongoDB. This change ensures more consistent and standardized date handling in a distributed environment.
  * **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 they are sent to or retrieved from MongoDB) that include milliseconds with a value of `.000` are not shown in the output generated by MongoDB Connector in Mule 4. This behavior differs from Mule 3, in which all date components are preserved.


Here is an example of the changes in date handling in a Mule app when migrating from Mule 3 to Mule 4:
Mule 3:
```
{
 "timeStamp": "2024-06-17T16:44:17.000+01:00"
}
```

Mule 4:
```
{
 "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 in Mule 4.
  * **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**
Document the key differences in date handling between Mule 3 and Mule 4 to ensure smooth transition and adaptation.


## Next Steps
After you complete the prerequisites and experiment with the example, you are ready to create an app with Studio.
## See Also
  * Introduction to Anypoint Connectors
  * MuleSoft Help Center