I have a blog. On the individual post page I want to display a link to the previous, and if there is one, next post published in the bottom. The link should be the title of
Find previous item:
Post.findOne({_id: {$lt: curId}}).sort({_id: -1}).exec(cb)
Find next item:
Post.findOne({_id: {$gt: curId}}).sort({_id: 1}).exec(cb)