Back

I want to track a list of favorites

  • 0
  • Self Hosted
  • Databases
  • General
  • Users
D3str0y3d255
23 Feb, 2024, 03:41

I want my User record to track a list of favorites. From my research I think I've found two viable solutions :

  1. Attach a relationship of the favorited item to the user.
  2. Have an array of Strings that holds all favorited items IDs, that I can parse later.

Note : The favorited items are all the same type, and therefore from the same collection.

Which would be the proper/best way to handle this?

  • and - What are the pros and cons of both methods?
TL;DR
Developers want to track a list of favorites for user records. The two viable solutions are: 1. attach a relationship of the favorited item to the user or 2. have an array of strings storing favorited item IDs. Pros and cons: 1. Attaching relationship: Pros - easier to query, maintain referential integrity. Cons - can be more complex, potentially slower. 2. Array of Strings: Pros - simpler setup, quicker access to all favorites. Cons - parsing may be required, can be less efficient for large datasets. Solution: Consider using solution 1 for scalability and better performance, unless dealing with
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