I have a collection
var mycoll = new Schema({
col1: { type: String,required: true,}
, col2: {type: String}
, mydate: {type: Date, required: true, default: Date.now,index:1}
etcetc
}, { collection: 'info' });
I a building a query based on mongoose like below
Info.statics.FindbyPage= function (callback, skip, limit) {
var infos = this.find();
infos.sort({ mydate: 1}).skip(skip).limit(limit);
res = infos.exec(callback)
}
the problem is that the result is not sorted by mydate, if i remove the limit and skip things the results will load all and they're well sorted once i put skip and limit the resutls is sorted but some date are missing ...
any help??? one thing to notice is i tried every possibilty in the sort param
i am using mongoose v3