MongoDB is a database, where you can store any kind of payload.
If you not already have an MongoDB instance running, here is a how-to.
It is not only possible to store information and query them, but MongoDB offers a variety of aggregation methods. In order to use these in a Streamsheet, you will need to work with the MONGO.AGGREGATE() function. Aggregation operators offer a variety of possibilities to interpret your data and help you generate an added value. Check out the official MongoDB Documentation to see all operators for yourself.
We want to analyze an existing database, where we stored the information on our customers (customerid, if they use the companies reward program and the total spent money on company products):
Our goal is now to find out, if customers in the reward program have spent more money in total as other customers. To specify our search we only look for high value customers (high value customers have at least spent 4000$) .
To translate this need into the language of MongoDB we have to create a JSON Range. Here we can use MongoDB operators to formulate our aggregation.
We first have to match our database entries to only list every entry with the parameter “Total spent money” over 4000. Moreover, we need to form two groups. One where the parameter “Reward program” is set to “TRUE” and one where it is set to “FALSE”. Finally, we are looking for the sum of the “total spent money” in each group, which we call “Total”.
After finishing the JSON, we now can define the parameters of our MONGO.AGGREGATE() function.
The MONGO.AGGREGATE() function:
Stream: Select a Producer, which is connected to the right MongoDB
Collection: Every MongoDB has collection, define the name of the collection
Aggregate JSON: The JSON-Range we defined previously
Target: Define the target for the output
This aggregation gave me the following output:
As we can see high value customers in the reward group have spent much more, then customers, who are not part of the reward program.
This is only a simple example. There are many more possibilities to interpret your data set. See the full list of operators here.