From 1a77dcf409b4cbf43bc0319dc14c5bf20e1f5c4e Mon Sep 17 00:00:00 2001 From: Mike Fitzpatrick Date: Sun, 4 Mar 2018 22:46:40 -0500 Subject: [PATCH] no message --- models/profile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/profile.js b/models/profile.js index 29a2d03..4720f20 100644 --- a/models/profile.js +++ b/models/profile.js @@ -173,7 +173,7 @@ module.exports = { { $match: { _id: Mongoose.Types.ObjectId(profileId), 'messages.image': { $exists: true } } }, { $unwind: '$messages' }, { $match: { 'messages.isUser': false, 'messages.image': { $exists: true } } }, - { $replaceRoot: { newRoot: '$messages.image' } } + { $replaceRoot: { newRoot: '$messages' } } ]) .project('messages.image -_id') .exec((err, result) => {