Why is an object's ID random by default rather than a string converted from the name? #8229
Replies: 1 comment
|
Random IDs are a deliberate safe default, but they are not mandatory. For resources whose API accepts an ID, you can supply a stable custom ID yourself instead of For example: const slug = 'customer-orders'
await databases.createCollection(
databaseId,
slug, // custom collection ID
'Customer orders',
)I would not make an automatic name-to-ID conversion the platform default, for a few reasons:
The usual pattern is therefore: use Current Appwrite endpoint descriptions explicitly state “choose a custom ID or generate a random ID with |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I started using Appwrite to build an app recently and noticed that nearly every object id is randomly chosen by default.
By testing on Appwrite Cloud, I understand that orgnization names and project names have chance to collide. But it's not the case for objects like databases, collections and more. These objects are isolated per-project and won't collide with objects in other projects.
I would recommend the sane default id for these objects to be a converted id from the name, i.e. convert Unicode characters to equivalents and whitespaces to hyphens etc.. But please tell me if this is a choice by design. Thank you!
All reactions