fix(project):sort
This commit is contained in:
@@ -17,6 +17,7 @@ class AbstractEngineClass(abc.ABC):
|
||||
self.soft_deleted = table_engine.soft_deleted
|
||||
self.unselect = table_engine.unselect
|
||||
self.return_query = table_engine.return_query
|
||||
self.collation = {'locale': 'fa'}
|
||||
|
||||
@abc.abstractmethod
|
||||
def exe(self):
|
||||
|
||||
@@ -54,6 +54,10 @@ class MongoEngine(AbstractEngineClass):
|
||||
else:
|
||||
tmp = tmp.sort(sort_by)
|
||||
|
||||
is_natural = isinstance(sort_by, dict) and sort_by.get('key_or_list') == '$natural'
|
||||
if getattr(self, 'collation', None) and not is_natural:
|
||||
tmp = tmp.collation(self.collation)
|
||||
|
||||
if self.input.e and self.input.e.ot:
|
||||
res = await tmp.to_list(None)
|
||||
self.input.e.d = await self.generate_output(res)
|
||||
|
||||
Reference in New Issue
Block a user