I have two MongoDB collections Customer
and User
in 1:1
relationship. I\'m trying to query both documents using Mongoose Population an
I don't know why people are saying you can't sort a populated field....
model.findOne({name: request.params.posts})
.populate('messages', '_id message createDate', null, { sort: { 'createDate': -1 } })
.exec(function(error, results) {
})
Where my model "posts", has a ObjectID messages array in it, that is populated here and sorted by it's createDate. It works great.