You need to use server sdk to add attributes dynamically
Can't we add attributes dynamically while creating a document in a specific Collection?
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 3: Container
You mean, While creating the document, we have to use Server side sdk to add the data right?
Rank 3: Container
You mean, we have to create a document using Server side sdk using Appwrite Functions right?
Yes you can use Appwrite functions, you can achieve that even without functions
https://appwrite.io/docs/getting-started-for-server
Follow this on how you can create database, colections, attributes etc
Rank 3: Container
Thanks Man
Rank 3: Container
Thanks 🙂
Rank 3: Container
[SOLVED]Can't we add attributes dynamically while creating a document in a specific Collection?
Rank 3: Container
brother, Can I add 4 attributes in of document and 15 attributes in second document. I mean, can I add like this using server SDK?
Rank 3: Container
I mean, Can I add Multiple and different attributes in different documents in the same COLLECTION?
Rank 3: Container
@RohitRanjan In a typical Collection, If one document contains 10 different attributes, another document in the same collection could contain 15 different attributes.
Rank 3: Container
Can I achieve this use case using appwrite server SDK? in the client side using functions?
Rank 3: Container
I dont want to create seperate server .
Rank 3: Container
Can't we add attributes dynamically while creating a document in a specific Collection?
Rank 3: Container
Could Anyone please respond 😦
Your use-case is common and generally very easy todo with NoSQL database.
Appwrite's actually MariaDB, which is relational DB.
If I was you I probably won't create the attribute on the fly as it can get crowded real fast.
What I suggest is to create the general attributes, for example, for your form case.
- form
- userID
- ... other indexable and searchable fields.
- json
Then inside the json I'll put everything as a json inside a big string attribute.
Also, you can go - I'm not a big fan - into EAV solution - like magento - check about it here. https://www.oscprofessionals.com/blog/understanding-different-layers-of-magento-module-development/
Rank 3: Container
@Binyamin The maximum size is so less, We have to mention the size of the string while uploading it right! So, If it won't be suffice, We can get into trouble right?
The maximum size is so less
What you mean? of the string attribute?
You can create a very big attribute as you can see here: https://discord.com/channels/564160730845151244/1116054662999724134/1116057738187919551
Rank 3: Container
If we use, So set it to 16777216 to have unlimited one , this size, Will it be unlimited?
Up to MariaDB limits.
Rank 3: Container
Okay alright, Is it okay
Rank 3: Container
to create JSON .stringify
Yes,
Rank 3: Container
Will hackathon judges judge me wrongly upon this?
Mmm, on that I can't tell you.