From 03bfed4e25e14432e8c80aac4334ecee9cd1730c Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 24 Apr 2023 22:54:01 +0000 Subject: [PATCH 1/2] Update create-document description and improve error message for unknown attribute. --- app/controllers/api/databases.php | 2 +- docs/references/databases/create-document.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index b309b74894..25a9fe1a6d 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -2399,7 +2399,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes') $attributeIndex = \array_search($attribute, array_column($oldAttributes, 'key')); if ($attributeIndex === false) { - throw new Exception(Exception::ATTRIBUTE_UNKNOWN, 'Unknown attribute: ' . $attribute); + throw new Exception(Exception::ATTRIBUTE_UNKNOWN, 'Unknown attribute: ' . $attribute . '. Verify the attribute name or create the attribute."); } $attributeStatus = $oldAttributes[$attributeIndex]['status']; diff --git a/docs/references/databases/create-document.md b/docs/references/databases/create-document.md index 10898b7d4d..b9292544a0 100644 --- a/docs/references/databases/create-document.md +++ b/docs/references/databases/create-document.md @@ -1 +1 @@ -Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](/docs/server/databases#databasesCreateCollection) API or directly from your database console. \ No newline at end of file +Create a new document. Before using this route, you should create a new collection and at least one attribute using either a [server integration](/docs/server/databases#databasesCreateCollection) API or directly from the Appwrite Console. \ No newline at end of file From 46038c9fef02fbda759c6b3bd2f2078a38dc4d28 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 12 Dec 2024 21:27:04 +0000 Subject: [PATCH 2/2] update PR fix quote --- app/controllers/api/databases.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 356fe92531..e403116969 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -2531,7 +2531,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes') $attributeIndex = \array_search($attribute, array_column($oldAttributes, 'key')); if ($attributeIndex === false) { - throw new Exception(Exception::ATTRIBUTE_UNKNOWN, 'Unknown attribute: ' . $attribute . '. Verify the attribute name or create the attribute."); + throw new Exception(Exception::ATTRIBUTE_UNKNOWN, 'Unknown attribute: ' . $attribute . '. Verify the attribute name or create the attribute.'); } $attributeStatus = $oldAttributes[$attributeIndex]['status'];