Skip to content
Snippets Groups Projects
Commit d80e0a50 authored by Inès Yeterian's avatar Inès Yeterian
Browse files

try to add merge operation to aggregation pipeline

parent 3fb02752
Branches
No related tags found
1 merge request!4Url/year/title
......@@ -22,7 +22,7 @@ const urltoucans = Toucan.aggregate([
{urlId:
{$concat:["$titlelcnospace","-","$year"]}}},
{$unset:["titlelc","year","titlelcnospace","title","date"]},
{$merge : "urls"}
{$out: "urls"}
]);
router.route("/toucans")
......@@ -139,21 +139,6 @@ router.route("/img/:id")
}
});
/* router.route("/pdf/:urlID")
.get(celebrate({params: validURL}), function(req,res) {
urltoucans.match({urlID: req.params.urlID}, (err,data) => {
if (err) {
res.end(500);
return;
}
else if (!data) {
res.status(404).send("Toucan non trouvé");
return;
}
//const id = data._id;
//res.sendFile(path.resolve(env.savedExtensions[1].path,id+".pdf"));
}
);}); */
router.get('/pdf/:urlId', (req, res) => {
try {
......@@ -174,20 +159,5 @@ router.get('/pdf/:urlId', (req, res) => {
}
});
router.get('/pdf/url', (req, res) => {
try {
urltoucans.
exec((err,data) => {
if (err) {
console.log(err);
} else {
res.json(data);
}});
} catch (err) {
console.log(err);
res.sendStatus(401);
}
});
module.exports = router;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment