I need results sorted alphabetically limiting 10 per page. But with my code, I get results as 10 per page alphabetically, next 10 again starts from 'a'. Likewise... My code is like,
pageNo := 1
perPage := 10
DB.C("collection").Find(bson.M{"_id": bson.M{"$in": ids}}).Sort("name").Skip((pageNo - 1) * perPage).Limit(perPage).All(&results)
Is there any way to sort all alphabetically first and then apply pagination?