From 4dae6e3eea8301c5ad35b709b26b39d37a7ddc7e Mon Sep 17 00:00:00 2001 From: Mike Fitzpatrick Date: Sun, 4 Mar 2018 22:07:47 -0500 Subject: [PATCH] no message --- models/profile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/profile.js b/models/profile.js index c25dc7c..a69b9c3 100644 --- a/models/profile.js +++ b/models/profile.js @@ -169,12 +169,12 @@ module.exports = { allMessageImages: (e, profileId) => { const promise = new Promise((resolve, reject) => { ProfileModel - .find({ _id: profileId }) + .find({ _id: profileId, 'messages.isUser': true, 'messages.image': { $exists: true } }) .select('messages') .populate({ path: 'messages', match: { $and: [{ isUser: true }, { image: { $exists: true } }, { text: { $exists: false } }] }, - select: 'image -_id', + select: 'image -_id -isUser -order -text -timestamp', sort: { order: 1 } }) .exec((err, result) => {