This guide explains how to run MongoDB queries on the Typper BI. Typper’s interface allows users to interact with your MongoDB collections using a structured JSON query format.

Prerequisites

Before you begin, make sure you have:

  1. A MongoDB collection within Typper BI’s data sources.

Running a MongoDB Query

To execute a MongoDB query, follow these steps:

  1. Navigate to the SQL query section in Typper BI.
  2. Instead of SQL, you’ll provide a JSON object to specify the MongoDB query. The JSON object should be structured as follows:
copy
{
  "collection": "name_of_your_collection",
  "aggregateParams": {
    // Your MongoDB aggregation pipeline
  }
}

Replace name_of_your_collection with the actual name of your MongoDB collection. In aggregateParams, provide the aggregation pipeline as a JSON object that defines the stages of your MongoDB query.

Example

Here’s an example of a simple aggregation that counts the number of documents grouped by a category field:

copy
{
  "collection": "products",
  "aggregateParams": [
    {
      "$group": {
        "_id": "$category",
        "count": { "$sum": 1 }
      }
    }
  ]
}

Executing the Query

After defining your query:

  1. Paste the JSON query into the Typper BI interface where SQL queries are typically entered.
  2. Click the Run button to execute the query.

The results will be displayed within the Typper BI platform, allowing you to analyze the output directly.

Limitations and Notes

  • Ensure that your JSON is properly formatted; otherwise, the query will not execute.
  • The aggregateParams field must contain a valid MongoDB aggregation pipeline array. Each element in the array represents a stage in the pipeline.

Conclusion

With Typper BI, you can seamlessly run MongoDB queries by leveraging JSON format to interact with your collections. Always review your queries for correct syntax and ensure you have the necessary permissions to access the data.

For more detailed information on MongoDB’s aggregation framework and query syntax, refer to the official MongoDB documentation.