Performance improvement for first - avoids unnecessary pagination.
This commit is contained in:
parent
c0fa1bef57
commit
129ef956b8
1 changed files with 1 additions and 1 deletions
|
@ -749,7 +749,7 @@ class FindQuery:
|
||||||
|
|
||||||
async def first(self):
|
async def first(self):
|
||||||
query = self.copy(offset=0, limit=1, sort_fields=self.sort_fields)
|
query = self.copy(offset=0, limit=1, sort_fields=self.sort_fields)
|
||||||
results = await query.execute()
|
results = await query.execute(exhaust_results=False)
|
||||||
if not results:
|
if not results:
|
||||||
raise NotFoundError()
|
raise NotFoundError()
|
||||||
return results[0]
|
return results[0]
|
||||||
|
|
Loading…
Reference in a new issue