From 92da81f73bfa46c19fc99420fe43aea3a004a51f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 15 May 2025 02:01:16 +1200 Subject: [PATCH 1/2] Re-force internal attribute selection --- src/Database/Adapter/MariaDB.php | 9 +- src/Database/Adapter/SQL.php | 34 ++-- src/Database/Database.php | 52 +----- tests/e2e/Adapter/Scopes/DocumentTests.php | 174 +++++------------- .../e2e/Adapter/Scopes/RelationshipTests.php | 78 ++++---- 5 files changed, 110 insertions(+), 237 deletions(-) diff --git a/src/Database/Adapter/MariaDB.php b/src/Database/Adapter/MariaDB.php index e9c639536..f2d33b285 100644 --- a/src/Database/Adapter/MariaDB.php +++ b/src/Database/Adapter/MariaDB.php @@ -128,14 +128,7 @@ public function createCollection(string $name, array $attributes = [], array $in $indexLength = $index->getAttribute('lengths')[$nested] ?? ''; $indexLength = (empty($indexLength)) ? '' : '(' . (int)$indexLength . ')'; $indexOrder = $index->getAttribute('orders')[$nested] ?? ''; - - $indexAttribute = match ($attribute) { - '$id' => '_uid', - '$createdAt' => '_createdAt', - '$updatedAt' => '_updatedAt', - default => $attribute - }; - + $indexAttribute = $this->getInternalKeyForAttribute($attribute); $indexAttribute = $this->filter($indexAttribute); if ($indexType === Database::INDEX_FULLTEXT) { diff --git a/src/Database/Adapter/SQL.php b/src/Database/Adapter/SQL.php index f88fec46f..ec34d7f34 100644 --- a/src/Database/Adapter/SQL.php +++ b/src/Database/Adapter/SQL.php @@ -1684,30 +1684,18 @@ protected function getAttributeProjection(array $selections, string $prefix = '' return '*'; } - $selections = \array_diff($selections, ['$id', '$permissions', '$collection']); + $internalKeys = [ + '$id', + '$internalId', + '$permissions', + '$createdAt', + '$updatedAt', + ]; - $selections[] = $this->getInternalKeyForAttribute('$id'); - $selections[] = $this->getInternalKeyForAttribute('$permissions'); + $selections = \array_diff($selections, [...$internalKeys, '$collection']); - if (\in_array('$internalId', $selections)) { - $selections[] = $this->getInternalKeyForAttribute('$internalId'); - $selections = \array_diff($selections, ['$internalId']); - } - if (\in_array('$createdAt', $selections)) { - $selections[] = $this->getInternalKeyForAttribute('$createdAt'); - $selections = \array_diff($selections, ['$createdAt']); - } - if (\in_array('$updatedAt', $selections)) { - $selections[] = $this->getInternalKeyForAttribute('$updatedAt'); - $selections = \array_diff($selections, ['$updatedAt']); - } - if (\in_array('$collection', $selections)) { - $selections[] = $this->getInternalKeyForAttribute('$collection'); - $selections = \array_diff($selections, ['$collection']); - } - if (\in_array('$tenant', $selections)) { - $selections[] = $this->getInternalKeyForAttribute('$tenant'); - $selections = \array_diff($selections, ['$tenant']); + foreach ($internalKeys as $internalKey) { + $selections[] = $this->getInternalKeyForAttribute($internalKey); } if (!empty($prefix)) { @@ -1720,7 +1708,7 @@ protected function getAttributeProjection(array $selections, string $prefix = '' } } - return \implode(', ', $selections); + return \implode(',', $selections); } protected function getInternalKeyForAttribute(string $attribute): string diff --git a/src/Database/Database.php b/src/Database/Database.php index 485a2c24a..8bce7eb5a 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -3169,6 +3169,7 @@ public function deleteIndex(string $collection, string $id): bool */ public function getDocument(string $collection, string $id, array $queries = [], bool $forUpdate = false): Document { + if ($collection === self::METADATA && $id === self::METADATA) { return new Document(self::COLLECTION); } @@ -3319,20 +3320,6 @@ public function getDocument(string $collection, string $id, array $queries = [], } } - // Remove internal attributes if not queried for select query - // $id, $permissions and $collection are the default selected attributes for (MariaDB, MySQL, SQLite, Postgres) - // All internal attributes are default selected attributes for (MongoDB) - foreach ($queries as $query) { - if ($query->getMethod() === Query::TYPE_SELECT) { - $values = $query->getValues(); - foreach ($this->getInternalAttributes() as $internalAttribute) { - if (!\in_array($internalAttribute['$id'], $values)) { - $document->removeAttribute($internalAttribute['$id']); - } - } - } - } - $this->trigger(self::EVENT_DOCUMENT_READ, $document); return $document; @@ -6034,6 +6021,7 @@ public function find(string $collection, array $queries = [], string $forPermiss if ($this->resolveRelationships && (empty($selects) || !empty($nestedSelections))) { $node = $this->silent(fn () => $this->populateDocumentRelationships($collection, $node, $nestedSelections)); } + $node = $this->casting($collection, $node); $node = $this->decode($collection, $node, $selections); @@ -6044,20 +6032,6 @@ public function find(string $collection, array $queries = [], string $forPermiss unset($query); - // Remove internal attributes which are not queried - foreach ($queries as $query) { - if ($query->getMethod() === Query::TYPE_SELECT) { - $values = $query->getValues(); - foreach ($results as $result) { - foreach ($this->getInternalAttributes() as $internalAttribute) { - if (!\in_array($internalAttribute['$id'], $values)) { - $result->removeAttribute($internalAttribute['$id']); - } - } - } - } - } - $this->trigger(self::EVENT_DOCUMENT_FIND, $results); return $results; @@ -6370,20 +6344,12 @@ public function decode(Document $collection, Document $document, array $selectio } } - if (empty($selections) || \in_array($key, $selections) || \in_array('*', $selections)) { - if ( - empty($selections) - || \in_array($key, $selections) - || \in_array('*', $selections) - || \in_array($key, ['$createdAt', '$updatedAt']) - ) { - // Prevent null values being set for createdAt and updatedAt - if (\in_array($key, ['$createdAt', '$updatedAt']) && $value[0] === null) { - continue; - } else { - $document->setAttribute($key, ($array) ? $value : $value[0]); - } - } + if ( + empty($selections) + || \in_array($key, $selections) + || \in_array('*', $selections) + ) { + $document->setAttribute($key, ($array) ? $value : $value[0]); } } @@ -6565,7 +6531,7 @@ private function validateSelections(Document $collection, array $queries): array $selections[] = '$updatedAt'; $selections[] = '$permissions'; - return $selections; + return \array_values(\array_unique($selections)); } /** diff --git a/tests/e2e/Adapter/Scopes/DocumentTests.php b/tests/e2e/Adapter/Scopes/DocumentTests.php index cd4db3959..2b87d8ff9 100644 --- a/tests/e2e/Adapter/Scopes/DocumentTests.php +++ b/tests/e2e/Adapter/Scopes/DocumentTests.php @@ -775,7 +775,6 @@ public function testGetDocumentSelect(Document $document): Document Query::select(['string', 'integer_signed']), ]); - $this->assertEmpty($document->getId()); $this->assertFalse($document->isEmpty()); $this->assertIsString($document->getAttribute('string')); $this->assertEquals('text📝', $document->getAttribute('string')); @@ -785,78 +784,26 @@ public function testGetDocumentSelect(Document $document): Document $this->assertArrayNotHasKey('boolean', $document->getAttributes()); $this->assertArrayNotHasKey('colors', $document->getAttributes()); $this->assertArrayNotHasKey('with-dash', $document->getAttributes()); - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); - $this->assertArrayNotHasKey('$collection', $document); - - $document = static::getDatabase()->getDocument('documents', $documentId, [ - Query::select(['string', 'integer_signed', '$id']), - ]); - $this->assertArrayHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); - $this->assertArrayNotHasKey('$collection', $document); - - $document = static::getDatabase()->getDocument('documents', $documentId, [ - Query::select(['string', 'integer_signed', '$permissions']), - ]); - - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayHasKey('$permissions', $document); - $this->assertArrayNotHasKey('$collection', $document); - - $document = static::getDatabase()->getDocument('documents', $documentId, [ - Query::select(['string', 'integer_signed', '$internalId']), - ]); - - $this->assertArrayNotHasKey('$id', $document); $this->assertArrayHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); - $this->assertArrayNotHasKey('$collection', $document); - - $document = static::getDatabase()->getDocument('documents', $documentId, [ - Query::select(['string', 'integer_signed', '$collection']), - ]); - - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); + $this->assertArrayHasKey('$createdAt', $document); + $this->assertArrayHasKey('$updatedAt', $document); + $this->assertArrayHasKey('$permissions', $document); $this->assertArrayHasKey('$collection', $document); $document = static::getDatabase()->getDocument('documents', $documentId, [ - Query::select(['string', 'integer_signed', '$createdAt']), + Query::select(['string', 'integer_signed', '$id']), ]); - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); + $this->assertArrayHasKey('$id', $document); + $this->assertArrayHasKey('$internalId', $document); $this->assertArrayHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); - $this->assertArrayNotHasKey('$collection', $document); - - $document = static::getDatabase()->getDocument('documents', $documentId, [ - Query::select(['string', 'integer_signed', '$updatedAt']), - ]); - - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$createdAt', $document); $this->assertArrayHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); - $this->assertArrayNotHasKey('$collection', $document); + $this->assertArrayHasKey('$permissions', $document); + $this->assertArrayHasKey('$collection', $document); + $this->assertArrayHasKey('string', $document); + $this->assertArrayHasKey('integer_signed', $document); + $this->assertArrayNotHasKey('float', $document); return $document; } @@ -1038,33 +985,6 @@ public function testFind(): array ]; } - /** - * @return void - * @throws \Utopia\Database\Exception - */ - public function testSelectInternalID(): void - { - $documents = static::getDatabase()->find('movies', [ - Query::select(['$internalId', '$id']), - Query::orderAsc(''), - Query::limit(1), - ]); - - $document = $documents[0]; - - $this->assertArrayHasKey('$internalId', $document); - $this->assertCount(2, $document); - - $document = static::getDatabase()->getDocument('movies', $document->getId(), [ - Query::select(['$internalId']), - ]); - - $this->assertArrayHasKey('$internalId', $document); - $this->assertCount(1, $document); - } - - - /** * @depends testFind */ @@ -2397,12 +2317,12 @@ public function testFindSelect(): void $this->assertArrayNotHasKey('director', $document); $this->assertArrayNotHasKey('price', $document); $this->assertArrayNotHasKey('active', $document); - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$collection', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); + $this->assertArrayHasKey('$id', $document); + $this->assertArrayHasKey('$internalId', $document); + $this->assertArrayHasKey('$collection', $document); + $this->assertArrayHasKey('$createdAt', $document); + $this->assertArrayHasKey('$updatedAt', $document); + $this->assertArrayHasKey('$permissions', $document); } $documents = static::getDatabase()->find('movies', [ @@ -2416,11 +2336,11 @@ public function testFindSelect(): void $this->assertArrayNotHasKey('price', $document); $this->assertArrayNotHasKey('active', $document); $this->assertArrayHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$collection', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); + $this->assertArrayHasKey('$internalId', $document); + $this->assertArrayHasKey('$collection', $document); + $this->assertArrayHasKey('$createdAt', $document); + $this->assertArrayHasKey('$updatedAt', $document); + $this->assertArrayHasKey('$permissions', $document); } $documents = static::getDatabase()->find('movies', [ @@ -2433,12 +2353,12 @@ public function testFindSelect(): void $this->assertArrayNotHasKey('director', $document); $this->assertArrayNotHasKey('price', $document); $this->assertArrayNotHasKey('active', $document); - $this->assertArrayNotHasKey('$id', $document); + $this->assertArrayHasKey('$id', $document); $this->assertArrayHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$collection', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); + $this->assertArrayHasKey('$collection', $document); + $this->assertArrayHasKey('$createdAt', $document); + $this->assertArrayHasKey('$updatedAt', $document); + $this->assertArrayHasKey('$permissions', $document); } $documents = static::getDatabase()->find('movies', [ @@ -2451,12 +2371,12 @@ public function testFindSelect(): void $this->assertArrayNotHasKey('director', $document); $this->assertArrayNotHasKey('price', $document); $this->assertArrayNotHasKey('active', $document); - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); + $this->assertArrayHasKey('$id', $document); + $this->assertArrayHasKey('$internalId', $document); $this->assertArrayHasKey('$collection', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); + $this->assertArrayHasKey('$createdAt', $document); + $this->assertArrayHasKey('$updatedAt', $document); + $this->assertArrayHasKey('$permissions', $document); } $documents = static::getDatabase()->find('movies', [ @@ -2469,12 +2389,12 @@ public function testFindSelect(): void $this->assertArrayNotHasKey('director', $document); $this->assertArrayNotHasKey('price', $document); $this->assertArrayNotHasKey('active', $document); - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$collection', $document); + $this->assertArrayHasKey('$id', $document); + $this->assertArrayHasKey('$internalId', $document); + $this->assertArrayHasKey('$collection', $document); $this->assertArrayHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); + $this->assertArrayHasKey('$updatedAt', $document); + $this->assertArrayHasKey('$permissions', $document); } $documents = static::getDatabase()->find('movies', [ @@ -2487,12 +2407,12 @@ public function testFindSelect(): void $this->assertArrayNotHasKey('director', $document); $this->assertArrayNotHasKey('price', $document); $this->assertArrayNotHasKey('active', $document); - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$collection', $document); - $this->assertArrayNotHasKey('$createdAt', $document); + $this->assertArrayHasKey('$id', $document); + $this->assertArrayHasKey('$internalId', $document); + $this->assertArrayHasKey('$collection', $document); + $this->assertArrayHasKey('$createdAt', $document); $this->assertArrayHasKey('$updatedAt', $document); - $this->assertArrayNotHasKey('$permissions', $document); + $this->assertArrayHasKey('$permissions', $document); } $documents = static::getDatabase()->find('movies', [ @@ -2505,11 +2425,11 @@ public function testFindSelect(): void $this->assertArrayNotHasKey('director', $document); $this->assertArrayNotHasKey('price', $document); $this->assertArrayNotHasKey('active', $document); - $this->assertArrayNotHasKey('$id', $document); - $this->assertArrayNotHasKey('$internalId', $document); - $this->assertArrayNotHasKey('$collection', $document); - $this->assertArrayNotHasKey('$createdAt', $document); - $this->assertArrayNotHasKey('$updatedAt', $document); + $this->assertArrayHasKey('$id', $document); + $this->assertArrayHasKey('$internalId', $document); + $this->assertArrayHasKey('$collection', $document); + $this->assertArrayHasKey('$createdAt', $document); + $this->assertArrayHasKey('$updatedAt', $document); $this->assertArrayHasKey('$permissions', $document); } } diff --git a/tests/e2e/Adapter/Scopes/RelationshipTests.php b/tests/e2e/Adapter/Scopes/RelationshipTests.php index 47a4aeffd..a230650f4 100644 --- a/tests/e2e/Adapter/Scopes/RelationshipTests.php +++ b/tests/e2e/Adapter/Scopes/RelationshipTests.php @@ -961,12 +961,12 @@ public function testSelectRelationshipAttributes(): void $this->assertEquals('Focus', $make['models'][1]['name']); $this->assertArrayNotHasKey('year', $make['models'][0]); $this->assertArrayNotHasKey('year', $make['models'][1]); - $this->assertArrayNotHasKey('$id', $make); - $this->assertArrayNotHasKey('$internalId', $make); - $this->assertArrayNotHasKey('$permissions', $make); - $this->assertArrayNotHasKey('$collection', $make); - $this->assertArrayNotHasKey('$createdAt', $make); - $this->assertArrayNotHasKey('$updatedAt', $make); + $this->assertArrayHasKey('$id', $make); + $this->assertArrayHasKey('$internalId', $make); + $this->assertArrayHasKey('$permissions', $make); + $this->assertArrayHasKey('$collection', $make); + $this->assertArrayHasKey('$createdAt', $make); + $this->assertArrayHasKey('$updatedAt', $make); // Select internal attributes $make = static::getDatabase()->findOne('make', [ @@ -977,12 +977,13 @@ public function testSelectRelationshipAttributes(): void throw new Exception('Make not found'); } + $this->assertArrayHasKey('name', $make); $this->assertArrayHasKey('$id', $make); - $this->assertArrayNotHasKey('$internalId', $make); - $this->assertArrayNotHasKey('$collection', $make); - $this->assertArrayNotHasKey('$createdAt', $make); - $this->assertArrayNotHasKey('$updatedAt', $make); - $this->assertArrayNotHasKey('$permissions', $make); + $this->assertArrayHasKey('$internalId', $make); + $this->assertArrayHasKey('$collection', $make); + $this->assertArrayHasKey('$createdAt', $make); + $this->assertArrayHasKey('$updatedAt', $make); + $this->assertArrayHasKey('$permissions', $make); $make = static::getDatabase()->findOne('make', [ Query::select(['name', '$internalId']), @@ -992,12 +993,13 @@ public function testSelectRelationshipAttributes(): void throw new Exception('Make not found'); } - $this->assertArrayNotHasKey('$id', $make); + $this->assertArrayHasKey('name', $make); + $this->assertArrayHasKey('$id', $make); $this->assertArrayHasKey('$internalId', $make); - $this->assertArrayNotHasKey('$collection', $make); - $this->assertArrayNotHasKey('$createdAt', $make); - $this->assertArrayNotHasKey('$updatedAt', $make); - $this->assertArrayNotHasKey('$permissions', $make); + $this->assertArrayHasKey('$collection', $make); + $this->assertArrayHasKey('$createdAt', $make); + $this->assertArrayHasKey('$updatedAt', $make); + $this->assertArrayHasKey('$permissions', $make); $make = static::getDatabase()->findOne('make', [ Query::select(['name', '$collection']), @@ -1007,12 +1009,13 @@ public function testSelectRelationshipAttributes(): void throw new Exception('Make not found'); } - $this->assertArrayNotHasKey('$id', $make); - $this->assertArrayNotHasKey('$internalId', $make); + $this->assertArrayHasKey('name', $make); + $this->assertArrayHasKey('$id', $make); + $this->assertArrayHasKey('$internalId', $make); $this->assertArrayHasKey('$collection', $make); - $this->assertArrayNotHasKey('$createdAt', $make); - $this->assertArrayNotHasKey('$updatedAt', $make); - $this->assertArrayNotHasKey('$permissions', $make); + $this->assertArrayHasKey('$createdAt', $make); + $this->assertArrayHasKey('$updatedAt', $make); + $this->assertArrayHasKey('$permissions', $make); $make = static::getDatabase()->findOne('make', [ Query::select(['name', '$createdAt']), @@ -1022,12 +1025,13 @@ public function testSelectRelationshipAttributes(): void throw new Exception('Make not found'); } - $this->assertArrayNotHasKey('$id', $make); - $this->assertArrayNotHasKey('$internalId', $make); - $this->assertArrayNotHasKey('$collection', $make); + $this->assertArrayHasKey('name', $make); + $this->assertArrayHasKey('$id', $make); + $this->assertArrayHasKey('$internalId', $make); + $this->assertArrayHasKey('$collection', $make); $this->assertArrayHasKey('$createdAt', $make); - $this->assertArrayNotHasKey('$updatedAt', $make); - $this->assertArrayNotHasKey('$permissions', $make); + $this->assertArrayHasKey('$updatedAt', $make); + $this->assertArrayHasKey('$permissions', $make); $make = static::getDatabase()->findOne('make', [ Query::select(['name', '$updatedAt']), @@ -1037,12 +1041,13 @@ public function testSelectRelationshipAttributes(): void throw new Exception('Make not found'); } - $this->assertArrayNotHasKey('$id', $make); - $this->assertArrayNotHasKey('$internalId', $make); - $this->assertArrayNotHasKey('$collection', $make); - $this->assertArrayNotHasKey('$createdAt', $make); + $this->assertArrayHasKey('name', $make); + $this->assertArrayHasKey('$id', $make); + $this->assertArrayHasKey('$internalId', $make); + $this->assertArrayHasKey('$collection', $make); + $this->assertArrayHasKey('$createdAt', $make); $this->assertArrayHasKey('$updatedAt', $make); - $this->assertArrayNotHasKey('$permissions', $make); + $this->assertArrayHasKey('$permissions', $make); $make = static::getDatabase()->findOne('make', [ Query::select(['name', '$permissions']), @@ -1052,11 +1057,12 @@ public function testSelectRelationshipAttributes(): void throw new Exception('Make not found'); } - $this->assertArrayNotHasKey('$id', $make); - $this->assertArrayNotHasKey('$internalId', $make); - $this->assertArrayNotHasKey('$collection', $make); - $this->assertArrayNotHasKey('$createdAt', $make); - $this->assertArrayNotHasKey('$updatedAt', $make); + $this->assertArrayHasKey('name', $make); + $this->assertArrayHasKey('$id', $make); + $this->assertArrayHasKey('$internalId', $make); + $this->assertArrayHasKey('$collection', $make); + $this->assertArrayHasKey('$createdAt', $make); + $this->assertArrayHasKey('$updatedAt', $make); $this->assertArrayHasKey('$permissions', $make); // Select all parent attributes, some child attributes From 0143a9bd56936ef75bdff7d3e184f2fbf499dd65 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 15 May 2025 16:54:09 +1200 Subject: [PATCH 2/2] Update src/Database/Database.php --- src/Database/Database.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Database/Database.php b/src/Database/Database.php index 8bce7eb5a..d006c9bec 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -3169,7 +3169,6 @@ public function deleteIndex(string $collection, string $id): bool */ public function getDocument(string $collection, string $id, array $queries = [], bool $forUpdate = false): Document { - if ($collection === self::METADATA && $id === self::METADATA) { return new Document(self::COLLECTION); }