Skip to content

Commit ac63954

Browse files
committed
NotFoundException
1 parent 91c9965 commit ac63954

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/Database/Database.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8481,6 +8481,11 @@ public function findOne(string $collection, array $queries = []): Document
84818481
public function count(string $collection, array $queries = [], ?int $max = null): int
84828482
{
84838483
$collection = $this->silent(fn () => $this->getCollection($collection));
8484+
8485+
if ($collection->isEmpty()) {
8486+
throw new NotFoundException('Collection not found');
8487+
}
8488+
84848489
$attributes = $collection->getAttribute('attributes', []);
84858490
$indexes = $collection->getAttribute('indexes', []);
84868491

@@ -8549,6 +8554,11 @@ public function count(string $collection, array $queries = [], ?int $max = null)
85498554
public function sum(string $collection, string $attribute, array $queries = [], ?int $max = null): float|int
85508555
{
85518556
$collection = $this->silent(fn () => $this->getCollection($collection));
8557+
8558+
if ($collection->isEmpty()) {
8559+
throw new NotFoundException('Collection not found');
8560+
}
8561+
85528562
$attributes = $collection->getAttribute('attributes', []);
85538563
$indexes = $collection->getAttribute('indexes', []);
85548564

0 commit comments

Comments
 (0)