Commit 0b64210f authored by andreagerino's avatar andreagerino

Adding explorations endpoint

parent 74d8c5b6
......@@ -296,6 +296,49 @@ router.get('/explorations/hpbylevel', function(req, res, next) {
});
router.get('/sonifications/bylevel', function(req, res, next) {
var collection = icarusDb.collection('resources');
var cursor = collection.aggregate(
// Pipeline
[
// Stage 1
{
$match: {
"appdata.appname" : "Invisible Puzzle",
"userdata.event" : "exploration",
"debug" : false
}
},
// Stage 2
{
$project: {
"identifier": {
"lvl": "$userdata.level.id",
"son": "$userdata.sonification"
}
}
},
// Stage 3
{
$group: {
"_id": "$identifier",
"count": {$sum: 1}
}
}
]
);
return_cursor(cursor, req, res, next);
});
function return_cursor(cursor, req, res, next){
cursor.toArray(function(err, result) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment