Converted sort from JS format to pymongo format