diff --git a/app/controllers/articles.js b/app/controllers/articles.js index 3f9d9c19..6c109823 100644 --- a/app/controllers/articles.js +++ b/app/controllers/articles.js @@ -80,7 +80,7 @@ exports.show = function(req, res) { * List of Articles */ exports.all = function(req, res) { - Article.find().sort('-created').populate('user').exec(function(err, articles) { + Article.find().sort('-created').populate('user', 'name username').exec(function(err, articles) { if (err) { res.render('error', { status: 500 diff --git a/app/models/article.js b/app/models/article.js index d53ee851..ff1e1868 100644 --- a/app/models/article.js +++ b/app/models/article.js @@ -44,7 +44,7 @@ ArticleSchema.statics = { load: function(id, cb) { this.findOne({ _id: id - }).populate('user').exec(cb); + }).populate('user', 'name username').exec(cb); } };