diff --git a/server/backend/database/mongo/client.go b/server/backend/database/mongo/client.go index bdceb2067..079b98cbd 100644 --- a/server/backend/database/mongo/client.go +++ b/server/backend/database/mongo/client.go @@ -256,7 +256,8 @@ func (c *Client) listProjectInfos( return nil, fmt.Errorf("fetch project infos: %w", err) } - if cursor.RemainingBatchLength() == 0 { + isLastPage := len(infos) < pageSize + if isLastPage { c.housekeepingProjectPage = 0 }