diff --git a/app.js b/app.js index 5be9bc5..6df18eb 100644 --- a/app.js +++ b/app.js @@ -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') }); }); }); diff --git a/lib/services/itunes/index.js b/lib/services/itunes/index.js index a127f76..4aac392 100644 --- a/lib/services/itunes/index.js +++ b/lib/services/itunes/index.js @@ -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); }