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