mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
21 lines
454 B
JavaScript
21 lines
454 B
JavaScript
var path = require("path");
|
|
var mongojs = require("mongojs");
|
|
var db = require(pathThumbnails + "/handlers/db.js");
|
|
|
|
function aggregate(collection, aggregateObject) {
|
|
return new Promise(async (resolve, reject) => {
|
|
db.collection(collection).aggregate(aggregateObject, function(
|
|
error,
|
|
results
|
|
) {
|
|
if (error) {
|
|
reject(error);
|
|
return;
|
|
}
|
|
resolve(results);
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = aggregate;
|