no message
This commit is contained in:
@@ -169,26 +169,20 @@ module.exports = {
|
|||||||
allMessageImages: (e, profileId) => {
|
allMessageImages: (e, profileId) => {
|
||||||
const promise = new Promise((resolve, reject) => {
|
const promise = new Promise((resolve, reject) => {
|
||||||
ProfileModel
|
ProfileModel
|
||||||
.findById(profileId, (err, profile) => {
|
.aggregate(
|
||||||
if (err) {
|
{ $match: { _id: profileId } },
|
||||||
reject(err);
|
{ $unwind: '$messages' },
|
||||||
}
|
{ $match: { 'messages.image': { $exists: true } } }
|
||||||
|
)
|
||||||
if (profile) {
|
.exec((err, result) => {
|
||||||
profile.messages
|
if (err) {
|
||||||
.find({ 'image': { $exists: true } })
|
reject(err);
|
||||||
.select('image -_id')
|
}
|
||||||
.exec((err, result) => {
|
|
||||||
if (err) {
|
if (result) {
|
||||||
reject(err);
|
resolve(result);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
if (result) {
|
|
||||||
resolve(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
promise.then((result) => {
|
promise.then((result) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user