no message

This commit is contained in:
2018-03-04 16:21:44 -05:00
parent 08fb835a64
commit 52560d71d0

View File

@@ -13,7 +13,7 @@ const ProfileSchema = new Mongoose.Schema({
"order" : { type: Number, default: 0 },
"details": {
"about": { type: String },
"age": { type: Number, index: true, default: 0 },
"age": { type: Number, index: true, defaulrt: 0 },
"body": { type: String },
"ethnicity": { type: String },
"gender": { type: String },
@@ -43,9 +43,6 @@ module.exports = {
ProfileModel
.find({})
.sort({ order: 1 })
.populate({
path: 'details'
})
.populate({
path: 'messages',
select: 'order text image isUser',
@@ -136,12 +133,6 @@ module.exports = {
find: (e, find) => {
const promise = new Promise((resolve, reject) => {
var query = ProfileModel.find(find);
if (!find.select.length || (find.select.length && find.length.indexOf('details'))) {
query.populate({
path: 'details'
});
}
if (!find.select.length || (find.select.length && find.length.indexOf('messages'))) {
query.populate({