Added a own aggregates file

- Aggregate and project missing fields
- Updated how channels are created, to add the new fields
This commit is contained in:
Kasper Rynning-Tønnesen
2018-09-28 11:13:49 +02:00
parent 3102893e15
commit 693e30f273
5 changed files with 151 additions and 127 deletions

View File

@@ -0,0 +1,57 @@
var toShowConfig = {
"addsongs": true,
"adminpass": 1,
"allvideos": 1,
"frontpage": 1,
"longsongs": 1,
"removeplay": 1,
"shuffle": 1,
"skip": 1,
"startTime": 1,
"userpass": 1,
"vote": 1,
"toggleChat": { $ifNull: [ "$toggleChat", true ] },
"description": { $ifNull: [ "$description", "" ] },
"thumbnail": { $ifNull: [ "$thumbnail", "" ] },
"rules": { $ifNull: [ "$rules", "" ] },
"_id": 0
};
var project_object = {
"_id": 0,
"id": 1,
"added": 1,
"now_playing": 1,
"title": 1,
"votes": 1,
"start": 1,
"duration": 1,
"end": 1,
"type": 1,
"source": { $ifNull: [ "$source", "youtube" ] },
"thumbnail": {
$ifNull: [ "$thumbnail", {
$concat : [ "https://img.youtube.com/vi/", "$id", "/mqdefault.jpg"]
} ]
}
};
var toShowChannel = {
start: 1,
end: 1,
added: 1,
id: 1,
title: 1,
votes: 1,
duration: 1,
type: 1,
_id: 0,
now_playing: 1,
type: 1,
source: 1,
thumbnail: 1,
};
module.exports.project_object = project_object;
module.exports.toShowConfig = toShowConfig;
module.exports.toShowChannel = toShowChannel;