Visualize, discover, and act on your data with metric visualizations and dashboards.
Ready to get the most from the data that's stored in your MongoDB database? Get started by adding some data feeds. When you're finished adding MongoDB data feeds, you'll use them to power your metrics.
This article includes:
Before you start
If you’re using Network Policies to restrict IP access, before adding a data feed, make sure you've added our PowerMetrics IP addresses to your allow list. See the full list of PowerMetrics' Allow list IP addresses.
When you connnect MongoDB data to PowerMetrics, you'll 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 in PowerMetrics, you'll 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.
Adding a MongoDB data feed
To add a MongoDB data feed:
- Add a new data feed by clicking the + button beside Data Feeds in the left navigation bar.
- Click Select data.
- On the Where is your data? page, click MongoDB.
- On the Configure data service page, fill in the following fields:
- At Host, enter your Host name.
- At Port, use the default port number provided by PowerMetrics.
- At Enable SSL, optionally select Enable SSL connection.
- At Authentication, optionally select Connect with username and password.
- At Database Name, enter your provided Database Name.
Make sure you enter the database name where the role of your username and password exists. - 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, then click Continue.
- You're taken to the data feed editor, where you can make changes to the data feed or save it as-is. If you want to modify the data feed, go to this article for detailed editing information.
- Give the data feed a name and, optionally, enter a description.
- Click Save data feed.
The data feed is added to your account and is ready to use for custom metrics. To see a list of all your data feeds, click Data Feeds in the left navigation sidebar.
Creating MongoDB metrics
Now that you've created one or more MongoDB data feeds, you can return to them and use them to make metrics. A single data feed can be used to create a single or multiple metrics.
To create MongoDB metrics:
- In the left navigation sidebar, click Data Feeds to open your list of data feeds.
- Select the MongoDB data feed you want to use for your metric.
- Click either the +Add metric button in the top right corner of the window or open the Metrics tab and click +Add metric. (See below.)
-
Choose settings for your metric and click Save metric. If you need help, go here to learn more.
The metric is added to your list of metrics, accessed by clicking Metrics in the left navigation sidebar.