...
To learn how to define a data hierarchy go to Creating a data hierarchy Data Collection Hierarchies
In this example we need the following hierarchy:
...
Aggregation config
Example aggregation (as found on S4DA CapDev measures) config for data collection named “consultants“. We want all consultants in a Province or district on a topo map:
...
Group Stage
Code Block | ||
---|---|---|
| ||
{
|
...
"$group": { |
...
"_id": |
...
"###hierarchy### |
...
", |
...
"count": { |
...
"$sum": 1 |
...
},
|
...
"capdev": { |
...
"$first": |
...
"$$ROOT" } |
...
|
...
}
|
...
}, |
Project Stage
Code Block | ||
---|---|---|
| ||
{
|
...
"$project": { |
...
"_id": 0, "name": "$_id.answers.name", "value": |
...
"$capdev.###hierarchyProjectionPath.iso### |
...
", |
...
"result": |
...
"$count |
...
" |
...
} |
...
} |
Explanations
Parameters:
“code: hierarchy”:
“code: hierarchySelector“:
...