diff --git a/models/profile.js b/models/profile.js index d4eb621..43cb866 100644 --- a/models/profile.js +++ b/models/profile.js @@ -172,7 +172,7 @@ module.exports = { .aggregate( { $match: { _id: profileId } }, { $unwind: '$messages' }, - { $match: { 'messages.image': { $exists: true } } } + { $match: { $and: [{ 'messages.isUser': false }, { 'messages.image': { $exists: true } }] } ) .exec((err, result) => { if (err) {