mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: change $sequence to string type to support MongoDB UUID7 values
The Document and Row response models were casting $sequence to (int), which destroyed UUID7 values on MongoDB. On MongoDB, $sequence is the internal _id field which is a UUID7 string, not an auto-increment integer. The (int) cast converted UUID7 values like "019c56a9-df6d-73fa-8d48-..." to 19, making $sequence queries fail validation with 400. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
7708f13ebd
commit
ecf0b4a1dd
@@ -37,10 +37,10 @@ class Document extends Any
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('$sequence', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Document automatically incrementing ID.',
|
||||
'default' => 0,
|
||||
'example' => 1,
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Document sequence ID.',
|
||||
'default' => '',
|
||||
'example' => '1',
|
||||
'readOnly' => true,
|
||||
])
|
||||
->addRule('$collectionId', [
|
||||
@@ -84,7 +84,7 @@ class Document extends Any
|
||||
$document->removeAttribute('$tenant');
|
||||
|
||||
if (!$document->isEmpty()) {
|
||||
$document->setAttribute('$sequence', (int)$document->getAttribute('$sequence', 0));
|
||||
$document->setAttribute('$sequence', (string)$document->getAttribute('$sequence', ''));
|
||||
}
|
||||
|
||||
foreach ($document->getAttributes() as $attribute) {
|
||||
|
||||
@@ -37,10 +37,10 @@ class Row extends Any
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('$sequence', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Row automatically incrementing ID.',
|
||||
'default' => 0,
|
||||
'example' => 1,
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Row sequence ID.',
|
||||
'default' => '',
|
||||
'example' => '1',
|
||||
'readOnly' => true,
|
||||
])
|
||||
->addRule('$tableId', [
|
||||
@@ -82,7 +82,7 @@ class Row extends Any
|
||||
{
|
||||
$document->removeAttribute('$collection');
|
||||
$document->removeAttribute('$tenant');
|
||||
$document->setAttribute('$sequence', (int)$document->getAttribute('$sequence', 0));
|
||||
$document->setAttribute('$sequence', (string)$document->getAttribute('$sequence', ''));
|
||||
|
||||
foreach ($document->getAttributes() as $column) {
|
||||
if (\is_array($column)) {
|
||||
|
||||
Reference in New Issue
Block a user