Give entities custom IDs (collections, documents, functions, etc) #1300
Replies: 4 comments
-
I think it would be really useful, in my scenario for functions. We separate development and production appwrite servers and there is no way to have the same ID on both. This results in additional steps both in the deployment phase and usage on the frontend. What prevents functionName from being used to reference a function instead of ID? Would custom ID counter this problem? |
Beta Was this translation helpful? Give feedback.
-
The most important entities to me are collections and documents. I also think that files and functions deserve custom IDs as well. CollectionsMaking the case as to why collections should have custom IDs is the easiest in my opinion. My reasoning is that when you're referencing the ID of a collection, you almost always know the ID beforehand. It's always a constant that I have to copy to my code. E.g. This would also be familiar to how MongoDB works as with MongoDB you create collections and give them names. And then you reference these collections by name. I also think the same reasoning can be applied to functions. DocumentsThere is less of an argument for allowing documents to have a custom ID. The only reason that I have is that I could use a userId as the documentId. However, this feature could be provided by the upcoming database changes that will allow specifying custom unique indexes. |
Beta Was this translation helpful? Give feedback.
-
As mentioned on Discord, I think the team is pretty much aligned that this should be supported That said, a crappy API for managing them will destroy and improvement the dev experience will get from this feature 😅 |
Beta Was this translation helpful? Give feedback.
-
An official RFC is available here: appwrite/rfc#26 - please post your feedback |
Beta Was this translation helpful? Give feedback.
-
This was discussed in the Discord server, and I'm bringing the discussion here for better tracking.
Proposal
It would be helpful if we could create collections and documents with custom IDs. Many document based databases (MongoDB for example) allow for this and it makes for really great DX.
Challenges and discussion points
Some initial challenges and things to discuss brought up by @eldadfux were:
Beta Was this translation helpful? Give feedback.
All reactions