Back

recommendation on modeling database in appwrite

  • 0
  • Databases
usk
12 Mar, 2023, 15:22

I am try to build a simple CRUD todo application using appwrite.I have a use case where where a user assign multiple tags to a given todo.I was hoping to have the type of tag as an array of strings (similar to Firestore) But appwrite does not seem to support raray of values as valid collection attribute type.How can i model this situation now? Should i have another tags collection and userId as on one of the attribute of the tags collection? Do we have concept of foreign keys similar to mySQL? What if i want to field is be one among give set of values (something like an enum ?) Do i need to create index?primary keys? I have exposure to relational database and often think in terms of relations and foreign key. I am front-end developer and my db skills are not that great. Any suggestion would be for great help.

TL;DR
The user is asking for recommendations on modeling a database in Appwrite for a CRUD todo application. They want to have multiple tags assigned to a todo and are wondering how to model this situation since Appwrite does not support arrays as valid collection attribute types. They also inquire about foreign keys, enums, indexes, and primary keys. The response suggests waiting for the next version which may include relationships. As a workaround, they suggest creating a string type and putting a serialized JSON inside. They also mention creating another 'tags' collection and using 'userId' as an attribute. No solution is provided.
Binyamin
12 Mar, 2023, 16:05

Have you try to create a String type and mark it as array?

usk
13 Mar, 2023, 16:20

@Binyamin Thanks. Is it possible to nest collections as well? or have values as object?

Binyamin
13 Mar, 2023, 16:34

You can't nest collection, AppWrite approach is to be fast as NoSql by providing NoSql-like syntax but eventually it's MariaDB (Relational) For the second question, there isn't any type for object, the only thing you can do is to create big string and put inside a serialized json.

VincentGe
14 Mar, 2023, 15:44

I the next version we're going to experiment with allowing relationships. You can wait for that to happen 😉

usk
14 Mar, 2023, 15:46

nice thanks👍

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more