Performance improvement for first - avoids unnecessary pagination.

This commit is contained in:
Simon Prickett 2022-04-25 13:05:11 +01:00
parent c0fa1bef57
commit 129ef956b8

View file

@ -749,7 +749,7 @@ class FindQuery:
async def first(self):
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:
raise NotFoundError()
return results[0]