fix: add missing await in MongoDB get_all_status_counts aggregation
Resolves 'coroutine' object has no attribute 'to_list' error in document pagination endpoint by adding missing await keyword before self._data.aggregate() call.
This commit is contained in:
parent
2af8a93dc7
commit
41de51a4db
1 changed files with 2 additions and 2 deletions
|
|
@ -366,7 +366,7 @@ class MongoDocStatusStorage(DocStatusStorage):
|
||||||
async def get_status_counts(self) -> dict[str, int]:
|
async def get_status_counts(self) -> dict[str, int]:
|
||||||
"""Get counts of documents in each status"""
|
"""Get counts of documents in each status"""
|
||||||
pipeline = [{"$group": {"_id": "$status", "count": {"$sum": 1}}}]
|
pipeline = [{"$group": {"_id": "$status", "count": {"$sum": 1}}}]
|
||||||
cursor = self._data.aggregate(pipeline, allowDiskUse=True)
|
cursor = await self._data.aggregate(pipeline, allowDiskUse=True)
|
||||||
result = await cursor.to_list()
|
result = await cursor.to_list()
|
||||||
counts = {}
|
counts = {}
|
||||||
for doc in result:
|
for doc in result:
|
||||||
|
|
@ -620,7 +620,7 @@ class MongoDocStatusStorage(DocStatusStorage):
|
||||||
Dictionary mapping status names to counts, including 'all' field
|
Dictionary mapping status names to counts, including 'all' field
|
||||||
"""
|
"""
|
||||||
pipeline = [{"$group": {"_id": "$status", "count": {"$sum": 1}}}]
|
pipeline = [{"$group": {"_id": "$status", "count": {"$sum": 1}}}]
|
||||||
cursor = self._data.aggregate(pipeline, allowDiskUse=True)
|
cursor = await self._data.aggregate(pipeline, allowDiskUse=True)
|
||||||
result = await cursor.to_list()
|
result = await cursor.to_list()
|
||||||
|
|
||||||
counts = {}
|
counts = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue