diff --git a/models/profile.js b/models/profile.js index cddc5ee..621dc04 100644 --- a/models/profile.js +++ b/models/profile.js @@ -169,7 +169,7 @@ module.exports = { allMessageImages: (e, profileId) => { const promise = new Promise((resolve, reject) => { ProfileModel - .find({ _id: profileId, 'messages.isUser': false, 'messages.image': { $exists: true } }) + .find({ $and: [{ _id: profileId }, {'messages.isUser': false}, {'messages.image': { $exists: true }}] }) .select('messages') .populate({ path: 'messages',