From c3358292aa4554bbb2056bafc5b4c992f1271f79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?In=C3=A8s=20Yeterian?= <ines.yeterian@student-cs.fr>
Date: Sun, 16 Jan 2022 20:10:33 +0100
Subject: [PATCH] try to speak mangoose

---
 backend/routes/routesToucan.js | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/backend/routes/routesToucan.js b/backend/routes/routesToucan.js
index 5e2f27f..35b769d 100644
--- a/backend/routes/routesToucan.js
+++ b/backend/routes/routesToucan.js
@@ -18,13 +18,9 @@ const urltoucans = Toucan.aggregate([
             {$reduce: 
                 {input: "$titlelc",initialValue: "",
                 in: { $concat : ["$$value", "$$this"]}}} }}, 
-    {$addFields:
-        {urlIdstring:
-            {$concat:["$titlelcnospace","-","$year"]}}}, 
     {$addFields:
         {urlId:
-            {$toObjectId :"$urlIdstring"}
-        }},
+            {$concat:["$titlelcnospace","-","$year"]}}}, 
     {$unset:["titlelc","year","titlelcnospace","title","date"]}, 
 ]);
 
@@ -162,7 +158,7 @@ router.route("/img/:id")
         try {  
               console.log(req.params.url);
               urltoucans.
-              match({urlID: mongoose.Types.ObjectId('boule-2022')}).
+              match({_id: mongoose.Types.ObjectId('5fc9e888f47f0041d8b83719')}).
               exec((err,data) => {
                 if (err) {
                   console.log(err);
-- 
GitLab