diff --git a/models/profile.js b/models/profile.js index ce92223..5c1a717 100644 --- a/models/profile.js +++ b/models/profile.js @@ -172,9 +172,9 @@ module.exports = { .find({ _id: profileId }) .select('messages') .populate({ - match: { image: { $ne: null } }, path: 'messages', - select: 'image' + match: { image: { $exists: true }, text: { $exists: false } }, + select: 'image -_id' }) .exec((err, result) => { if (err) {