MongoDB Integration with Boomi: A Step-by-Step Guide
MongoDB is a NoSQL document database, storing data in a type of JSON format called BSON. Integrating MongoDB with Boomi offers several advantages, making it a strategic choice for organizations looking to streamline their data workflows and enhance overall efficiency. This blog will guide you through two essential tasks: querying data from MongoDB and creating new data entries. Read more about how its done:
1. Query data from MongoDB:
Create a process with shapes in Boomi as shown in the below image.
Click on Configure, to configure the MongoDB connector.
Create a new connection by clicking on the + icon in the Connection field.
For creating a local host connection, we need Hostname/ IP address, Port number and Database name. The Default Port number is 27017.
The Database name and Host can be retrieved from the MongoDB compass.
The Host name will be shown while creating a new connection. If not saved, you can verify the information in the connection details next to the connection name in MongoDB Compass.
The Database name will be available in the Compass Dashboard.
Enter all the details below into the MongoDB connection.
Test the connection before saving and use it only if the test connection is successful.
After configuring the connection, set the Action field to Query. Next, create a new operation by clicking the + icon in the operation field.
In the new operation, click on the Import Operation button to import the profile.
In the popup, choose values for Atom, connection, Option field checked, Datatype as ObjectId and Id.
Retrieve the ObjectId of any existing data within the collection and then input this ObjectId value into the Id field.
Also, a proper JSON schema will be generated only when the Options field is checked.
Click on next, after passing all the values. On the next tab, you should see the collection from which you have passed the Id.
Click on next and the, operation will be successfully loaded.
With the successful loading of the operation, you are now ready to proceed with testing.
If you want to query only records based on specific fields, you can use the filters in the operation.
Click on save and close for operation ok to the connector.
After the process has been done configuration, save and test the process using a local atom.
You should get all the documents matching the operation from that collection at the MongoDB shape in Connection Data.
In the document, the value of field $oid is the Objectid. This Objectid will be shown, only when _id > $oid field is checked in the operation.
2. Create data on MongoDB:
Create a process with shapes in Boomi as shown in the below image.
Configure the message shape to pass the input data in a proper JSON format, to create a new document in MongoDB.
After passing the input in message shape, now configure the MongoDB shape as done in the previous process. You can use the same connection for this process.
While creating the operation, make sure to create a new Operation when the Action field is being set to Create.
Import the Operation, using the ObjectId of an existing data as done in the previous process.
After Configuring the Operation, save and close the operation. Click on OK on the connector to save changes made on the connector.
Now, in the map shape, create a new map, and map the fields in the input shape to the destination JSON profile properly.
After configuring all the shapes has been done properly, save the process and test it using a local atom.
The connection data of the MongoDB shape must contain the created documentJSON data in it.
And the Stop shape will contain the ObjectId of the created document in Shape Source Data.
We can also verify whether the document is created or not by checking the collection in MongoDB Compass as in the below image.