I have below route in my app.js
// Home Route
app.get('/', function(req, res){
Entry.find({}, function(err, entries){
if(err){
console.log(err);
} else {
res.render('index', {
entries: entries
});
}
});
});
This is displaying all entries in Entry collection. I would like to display only last 100 records from db. What is the best way to do it?
I am using with below pug layout.
extends layout
block content
h1 #{title}
ul.list-group
each entry, i in entries
li.list-group-item
a(href=entry.entryurl)= entry.title