3
model.find({city: city, sort: 'cityname ASC'}, function(err, cityList){});

the above code giving the correct sorting list but whenever the city is in both uppercase or lowercase like Coimbatore,bangalore,Chennai it gives the output as Chennai,Coimbatore,bangalore but i need the output as bangalore,Chennai, Coimbatore like that. Please help me to get the output as i wanted.. and advace thanking to you all..

4

1 回答 1

3

这是 MongoDB 中的一个错误-AFAIk 目前还没有真正的解决方案

更新:我发现的一种解决方法 - 第二次存储字符串仅大写或仅小写并按该属性排序:http: //futurestud.io/blog/case-insensitive-sorting-with-mongoose-and-mongodb /

于 2014-11-18T14:28:54.450 回答