【发布时间】:2020-05-20 18:29:54
【问题描述】:
我的app.js 中有以下route
// Home Route
app.get('/', function(req, res){
Entry.find({}, function(err, entries){
if(err){
console.log(err);
} else {
res.render('index', {
entries: entries
});
}
});
});
这是在条目集合中显示所有条目。我只想显示数据库中的最后 100 条记录。最好的方法是什么?
我正在使用下面的pug 布局。
extends layout
block content
h1 #{title}
ul.list-group
each entry, i in entries
li.list-group-item
a(href=entry.entryurl)= entry.title
【问题讨论】: