Global Configuration
MongoDB Connector Migration Guide
The MongoDB connector v4.0.2 is a completely revamped connector and is not compatible with any of its older versions.
Release Notes: MongoDB 4.0.2 Connector Release Notes
Connector Guide: MongoDB Connector Overview
MongoDB Version 4.x Versus Previous Versions
MongoDB Connector 4.x | Previous versions | |
---|---|---|
The previous version of the connector requires the following credentials: username, password, database, host, and port. |
Mongo DataTypes |
|
|
|
Payload Manipulation |
New Operation Names
-
With the driver update, we also updated the operation names to suit driver changes.
Mongo 3.x Operation | Mongo 4.x Operation |
---|---|
Count objects |
Count documents |
End consistent request |
This operation has been deleted |
Find one object |
Find one document |
Insert object |
Insert document |
Remove object |
Remove document |
Save object |
Save document |
Start consistent request |
This operation has been deleted |
Update objects |
Update documents |
Update objects by function |
Update documents by function |
"XX using query map" |
All these operations have been deleted. You now use DataWeave to create a query. |
Updating From an Older Version
-
Uninstall the previous MongoDB Connector.
-
In Anypoint Studio, click Help > Install New Software. In the Works with drop-down menu, click
Anypoint Connectors Update Site
. -
Expand the Select category and click Mongo DB Connector version 4.x (x is the latest version number).
-
Ensure that the Maven dependencies have been updated correctly from Mongo DB[v3.X.X] to Mongo DB[v4.0.2] (or the latest version).
-
Update flows that are using Phased Out or Deprecated operations.
-
Most operation names have been changed to comply with Mongo Driver v3, so if you had an InsertObject operation, now it appears as InsertDocument.
-
WriteResult objects have been removed. Now your operations only return Strings, Documents and DBObjects.
-
MongoDB transformers have been replaced by implicit ones. So, if your input data is a Map and, you want to perform an Insert operation, just drag a MongoDB connector into the workspace, choose the InsertDocument operation and you’re done! You no longer require the use of the transformer.
-
Remember that
mongo:config
does NOT support the port field anymore. Now you have to specify the port inside the host field of yourmongo:config
using the format "host:port".
-
Post Installation
The following sections describe how to complete an installation from either Maven or non-Maven projects.
Maven-Based Project
-
Open the project’s pom.xml file and delete any references to the older version. The artifact-id of the previous versions follow this format:
mule-module-mongo
-
Add the MongoDB connector reference by setting the version property to
4.0.2
(or the latest version). -
Save your pom.xml file changes.
You may need to manually update the project dependencies.
Non-Maven Based Project
-
Locate the MongoDB connector library, right-click the library, and click Build Path > Remove from Build Path.
-
To import the MongoDB connector v4.0.2 library, right-click the project, click Build Path > Add Libraries > Anypoint Connectors Dependencies, and locate Mongo DB v4.0.2.
After following the steps above, update your flows by replacing the MongoDB Connector with the newer version and its data mappings.