You can set up a connection between Klipfolio Klips and MongoDB to display data from your database on a dashboard.
This article includes:
- Connecting to your MongoDB data
- Creating a MongoDB data source
- Creating a MongoDB custom Klip
- Creating MongoDB data feeds in PowerMetrics
Connecting to your MongoDB data
Important: Before connecting Klipfolio with MongoDB, ensure the IP addresses listed here have been added to your allow list.
To connect to MongoDB data in Klipfolio, you will need to provide your Host name, Database Name and a Collection Name. You can get this information from the administrator of your organization.
Before entering Query Parameters on the Configuring Data Source page, you will need to select a Collection Method. See below for more information on the Find and Aggregate options:
Query parameters for Find:
In the Query Parameters text box, enter the query and/or projection parameters in valid JSON/BSON format.
For example: [{id : {$eq : 1}}, {name : 1}]
If you enter {} in the Query Parameters text box, all documents in the collection will be returned.
Learn more about the Find collection.
Query parameters for Aggregate:
In the Query Parameters text box, enter the pipeline parameter in JSON/BSON format.
For example: [{$project : {id:1, fname:1}},{$group: {id: dept, total: {$sum: $amount}}}, {$sort: {id: -1}}]
Learn more about the Aggregate collection.
Creating a MongoDB data source
To create a MongoDB data source:
- Navigate to the Service Connectors page in Klipfolio and choose MongoDB from the list.
- On the Configure your data source page, enter the following:
- At Host, enter your Host name.
- At Port, use the default port number provided by Klipfolio.
- At Enable SSL, optionally select Enable SSL connection.
- At Authentication, optionally select Connect with username and password. Make sure you also enter the correct authentication database name where the role of your username and password exists.
- At Database Name, enter your provided Database Name.
- At Collection Name, enter your provided Collection Name.
- At Collection Method, select either Find or Aggregate. See more information above.
- At Query Parameters, enter your Query Parameters based on your chosen Collection Method.
- Click Get data.
- Ensure this is the data you’re looking for. Optionally, select the checkbox to Model your data. Learn more about modelling data sources.
- Click Continue.
- Name, choose refresh settings, and, optionally, share your data source.
- Click Save.
Creating a MongoDB custom Klip
You create custom Klips from either your list of Klips or your Dashboard. You choose a data visualization format, for example, a pie chart, gauge, or table, and decide whether you want to use an existing data source or create a new one. In the Klip Editor, there are limitless opportunities to modify, relate, and display your data. See the following related articles for more information and get building!
Creating MongoDB data feeds in PowerMetrics
In this article you learned how to connect to MongoDB to create data sources in Klipfolio Klips. You can also connect to MongoDB to create data feeds (and data feed metrics) in Klipfolio PowerMetrics. The method for creating data feeds is similar to the steps described above, with a few exceptions:
- You start by clicking the + button beside Metrics (in the left navigation sidebar) > See all services. Under Data Feed Services, select MongoDB. Click +New data feed > Select MongoDB data.
- After querying and configuring the data source (as described above) and getting data, you're taken to the data feed editor where you can make adjustments to the data feed or save it as-is. If applicable, go here to learn how to configure data feeds for services that return JSON/XML data.
- When you configure a data feed metric, you select the measure and dimensions from the data feed to include in the metric and choose settings that determine how the data will be visualized. Go here for detailed instructions on configuring a metric.