Xplenty can integrate various data sources. One of the services it can integrate with is MongoLab, a MongoDB-as-a-service. This post will demonstrate how to connect them together and enjoy the advantage of working with MongoDB and Hadoop on the cloud.
Sign in into your MongoLab account or sign up if you don’t have one.
Click the relevant DB in the dashboard. If you don’t have a DB, you can create a free sandbox by clicking Create New, Single-node (development), and choosing the Sandbox plan. For more details, please see MongoLab’s documentation.
Create a collection for the DB if one isn’t available by clicking the Add Collection button.
A database user must be added. If there is no user, a yellow message will appear with a link to create one. Click it and follow the instructions. Keep a note with the database username and password on the side (note - they may be different than the username and password for the entire MongoLab account).
Back on the database screen, look for the line “To connect using a driver via the standard URI”. Check the line that appears below it and note down the host and port number. E.g., if the URI displayed is
mongodb://<dbuser>:<dbpassword>@ds045557.mongolab.com:45557/naftsen, then the host is ds045557.mongolab.com and the port number is 45557.
If you need to migrate data into your MongoLab database, please refer to the documentation.
In your account, click the user image on the top right and choose Account settings.
Click the Connections menu on the left, click New Database Connection, and choose MongoDB.
Enter any name that you want for the connection, and then insert the relevant MongoLab database details. Note that the username and password are for the specific database which you are trying to access, not the MongoLab account. Also make sure to disable the “Connect using SSL” checkbox since it isn’t supported for a MongoLab connection.
Click the Test Connection button at the bottom to make sure the connection works. If it fails, one of the details that you entered is incorrect. Go back to the MongoLab Settings section and make sure all the details are accurate.
Click the Create MongoDB Connection button.
Open an existing Xplenty package or create a new one via My Packages, New Package.
Click the component that was just added. The MongoDB Source dialog should appear. Choose the MongoDB connection that you previously created in the MongoDB Connection dropdown, and click the green auto-detect schema button on the right. The schema should be filled automatically. Also make sure to enter the source collection name. For more info how to work with MongoDB source components, please refer to the help section.
Back on the package screen, add components to process the data as necessary.
To save the processed data back on MongoLab, add a MongoDB destination. Click the component to open the edit dialog. Choose the relevant MongoDB connection and enter the target collection.