MONGO.AGGREGATE
Gets aggregated data from your Mongo database. You can use the Function Wizard to create this function. Operators for the query aggregations can be found here.
Syntax
=MONGO.AGGREGATE(Connection, Collection, Aggregate JSON, Target, [Result Keys], [Timeout])
Arguments
| Name | Type | Description |
|---|---|---|
| Connection | Connection | Reference to connection used for aggregating. The database name is configured in the affiliated connection settings. |
| Collection | String | Choose an existing collection, where the items are stored. |
| Aggregate JSON | JSON | Define an aggregation using a JSON cell range. |
| Target | Target | INBOX(), OUTBOX("MsgID") or a cell range where the result will be placed. Make sure the cell range is big enough or not everything is displayed. |
| Result Keys (optional) | Range | Filter the result. |
| Timeout (optional) | Number | Define Timeout in seconds. |
Return
TRUE, if no error.
Examples
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Collection: | REP_SALES | |||
| 2 | customerid | F7ZF5 | 0 | ||
| 3 | Reward_program | TRUE | $match | ||
| 4 | Total spent money | 2116 | Total spent money | ||
| 5 | $gt | 1500 | |||
| 6 | MONGO.STORE | 1 | |||
| 7 | $group | ||||
| 8 | _id | Total | _id | $Reward_program | |
| 9 | TRUE | 41053 | Total | ||
| 10 | FALSE | 15724 | $sum | $Total spend money | |
| 11 | |||||
| 12 | MONGO.AGGREGATE |
| Formula | Result | Comment |
|---|---|---|
| In A8:B13 | Divides the result in two groups, which calculate the total sales above 1500 Euro. |