We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5ae845 commit 1a3556eCopy full SHA for 1a3556e
django_mongodb_backend/cache.py
@@ -5,7 +5,7 @@
5
from django.core.cache.backends.db import Options
6
from django.db import connections, router
7
from django.utils.functional import cached_property
8
-from pymongo import IndexModel, ReturnDocument
+from pymongo import ASCENDING, DESCENDING, IndexModel, ReturnDocument
9
from pymongo.errors import DuplicateKeyError, OperationFailure
10
11
@@ -129,7 +129,7 @@ def _cull(self, num):
129
deleted_from = next(
130
self.collection_for_write.aggregate(
131
[
132
- {"$sort": {"expires_at": -1, "key": 1}},
+ {"$sort": {"expires_at": DESCENDING, "key": ASCENDING}},
133
{"$skip": keep_num},
134
{"$limit": 1},
135
{"$project": {"key": 1, "expires_at": 1}},
0 commit comments