sort on created date

This commit is contained in:
Jonathan Cremin 2014-12-13 12:12:44 +00:00
parent 23896f7ee6
commit 0c1bcb728d
2 changed files with 2 additions and 2 deletions

2
app.js
View file

@ -60,7 +60,7 @@ app.get('*', function(req,res,next) {
});
app.get('/', function(req, res) {
req.db.matches.find().sort({$natural:-1}).limit(6).toArray().then(function(docs){
req.db.matches.find().sort({created_at:-1}).limit(6).toArray().then(function(docs){
res.render('index', { page: "home", recent: docs, error: req.flash('search-error') });
});
});

View file

@ -30,7 +30,7 @@ module.exports.parseUrl = function(url) {
};
module.exports.lookupId = function(id, type, cc) {
if (id.match(/^[a-z]{2}/)) {
if (String(id).match(/^[a-z]{2}/)) {
cc = id.substr(0,2);
id = id.substr(2);
}