#community-help

Best Way to Manage User Favorites in a Video App

TLDR Jesse asked about effectively managing user favorite videos in an app. Kishore Nallan suggested using collection joins set to be supported in their next version.

Powered by Struct AI
Jul 28, 2023 (4 months ago)
Jesse
Photo of md5-72cd246b57acc3175ff86dc07bf585ed
Jesse
03:01 AM
Hi all,

I am wanting to know if storing a large number of strings in an array is bad for an application like this?

Let’s say that I have a video app, and I want the users to be able to favorite videos, then to later be able to search their favorites, would this be the best option?

I was thinking of creating a separate collection for each user with their favorites, but this could be bad as evetime the video is updated (or even deleted), I would have to update it in every user’s collection (if I have 1,000,000 users favorite a video, and the title changes, I would have to update 1,000,000 times - once for each collection).
Image 1 for Hi all,

I am wanting to know if storing a large number of strings in an array is bad for an application like this?

Let’s say that I have a video app, and I want the users to be able to favorite videos, then to later be able to search their favorites, would this be the best option?

I was thinking of creating a separate collection for each user with their favorites, but this could be bad as evetime the video is updated (or even deleted), I would have to update it in every user’s collection (if I have 1,000,000 users favorite a video, and the title changes, I would have to update 1,000,000 times - once for each collection).
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:53 AM
👋 We support collection joins in the next version so that's probably the best way to model this. Store the favorites in a separate collection and you can join them at query time.

See here: https://github.com/typesense/typesense/issues/229#issuecomment-1645573572
Jesse
Photo of md5-72cd246b57acc3175ff86dc07bf585ed
Jesse
09:05 PM
This is Awesome! I can't wait for it to be released!