Case insensitive criteria sorting

To create a criteria for search I do this :




$criteria = new EMongoCriteria();

$criteria->sort('name',EMongoCriteria::SORT_ASC);



This search for result and sort them by name. But unfortunately, it doesn’t insensitively sort the result ie word begins with letter “B” will appears before letter “a” because the ASCII code “B” is smaller than “a”.

Please help me to find a solution.

change your table charset to utf8_general_ci ?

It appears that this is a limitation with MongoDB:

https://jira.mongodb.org/browse/SERVER-90

One work-around suggested by the MongoDB supporters is to use an extra duplicated field, with all inserts to that field using .toLower()

Messy I know but perhaps it’s been fixed now?