Skip to content

Commit 8aa7100

Browse files
abnegateclaude
andcommitted
fix: map empty attribute to _id in Mongo::getInternalKeyForAttribute
Query::orderAsc() with no attribute produces an empty string. SQL adapters treat this as a no-op ORDER BY on the auto-increment key, but Mongo built an invalid sort on '' causing queries to hang. Map '' -> '_id' alongside '$sequence' so empty orderAsc() sorts by the MongoDB sequence key, matching SQL adapter behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 19305fc commit 8aa7100

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Database/Adapter/Mongo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,7 @@ protected function getInternalKeyForAttribute(string $attribute): string
19781978
{
19791979
return match ($attribute) {
19801980
'$id' => '_uid',
1981-
'$sequence' => '_id',
1981+
'', '$sequence' => '_id',
19821982
'$collection' => '_collection',
19831983
'$tenant' => '_tenant',
19841984
'$createdAt' => '_createdAt',

0 commit comments

Comments
 (0)