diff --git a/src/Appwrite/Utopia/Response/Model/Index.php b/src/Appwrite/Utopia/Response/Model/Index.php index 2d795ad439..e18a9db334 100644 --- a/src/Appwrite/Utopia/Response/Model/Index.php +++ b/src/Appwrite/Utopia/Response/Model/Index.php @@ -4,6 +4,7 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Model; +use Utopia\Database\Document; class Index extends Model { @@ -34,7 +35,7 @@ class Index extends Model 'default' => '', 'example' => 'string', ]) - ->addRule('attributes', [ + ->addRule('columns', [ 'type' => self::TYPE_STRING, 'description' => 'Index attributes.', 'default' => [], @@ -78,4 +79,16 @@ class Index extends Model { return Response::MODEL_INDEX; } + + public function filter(Document $document): Document + { + + $columns = $document->getAttribute('attributes', []); + $document + ->removeAttribute('attributes') + ->setAttribute('columns', $columns); + + return $document; + + } }