Feature request
Although defining collations on indexes is doable through meta, it's not currently possible to define a collation on a query as specified by the PyMongo API
The current use-case is that of a case-insensitive indexed query - which could be done using regexes, but that would incur the cost of a scan as opposed to using the actual index.
Let me take this one.
Was trying to do the same almost at the same time as when this feature request was made :D.
My workaround was this:
@property
def _cursor(self):
if self._cursor_obj:
return self._cursor_obj
self._cursor_obj = QuerySet._cursor.fget(self)
self._cursor_obj.collation(Collation(locale="en", strength=CollationStrength.SECONDARY))
return self._cursor_obj
Looking forward to the actual feature implementation.
Most helpful comment
Let me take this one.