no message

This commit is contained in:
2018-03-04 22:30:22 -05:00
parent 556085ebd0
commit 447817212a

View File

@@ -169,15 +169,11 @@ module.exports = {
allMessageImages: (e, profileId) => {
const promise = new Promise((resolve, reject) => {
ProfileModel
.findById(profileId, (err, profile) => {
if (err) {
reject(err);
}
if (profile) {
profile.messages
.find({ 'image': { $exists: true } })
.select('image -_id')
.aggregate(
{ $match: { _id: profileId } },
{ $unwind: '$messages' },
{ $match: { 'messages.image': { $exists: true } } }
)
.exec((err, result) => {
if (err) {
reject(err);
@@ -186,8 +182,6 @@ module.exports = {
if (result) {
resolve(result);
}
});
}
});
});