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

try to find last toucan in a fast way

parent 6ea01ca6
Branches
No related tags found
1 merge request!6Last toucan
...@@ -149,11 +149,12 @@ router.get('/pdf/:year/:title', (req, res) => { ...@@ -149,11 +149,12 @@ router.get('/pdf/:year/:title', (req, res) => {
}); });
}); });
router.get('/pdf/lastToucan', (res) => { router.get('/pdf/lastToucan', (req, res) => {
Toucan.find() Toucan.find()
.exec(function(err, toucans){ .exec(function(err, toucans){
if(err) {res.send(err);} if(err) {res.send(err);}
else{ else
{
var max = new Date(toucans[0].date); var max = new Date(toucans[0].date);
var idMax = toucans[0]._id; var idMax = toucans[0]._id;
const nbToucans = toucans.length; const nbToucans = toucans.length;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment