From d80e0a50712613beaa3c0d45f254b92cec8c4ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A8s=20Yeterian?= <ines.yeterian@student-cs.fr> Date: Sat, 22 Jan 2022 01:24:14 +0100 Subject: [PATCH] try to add merge operation to aggregation pipeline --- backend/routes/routesToucan.js | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/backend/routes/routesToucan.js b/backend/routes/routesToucan.js index 52c42d4..cd622ff 100644 --- a/backend/routes/routesToucan.js +++ b/backend/routes/routesToucan.js @@ -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 -- GitLab