How would YouTube store data of who liked which videos?

If Youtube uses MongoDB as their database, then how would they store the who liked which videos information?

Option 1:

Store it in the Videos collection with a field that holds a list of subdocuments containing the user id and weather they liked it or disliked it.

Option 2:

Store it in the Users collection with a field that holds a list of subdocuments containing the video id and weather they liked it or disliked it.

Option 3:

Store this many-to-many relation in its own collection.

Questions.

  • Would the document size in Options 1 be at risk of exceeding the 16 MB limit?
  • Would the document size in Options 2 be at risk of exceeding the 16 MB limit?

I would guess {option:3} together with {option:2)

The use-case involve is a the user watching a video with like or dislike icon on or off.

I am ruling out completely {option:1} because when a user watch a video, he is not interested who else liked or not the video. He is interested about the count. So the video might use the computed pattern to keep the total count. If a video is viral the 16MB could be easily reach.

It could be {option:2} partially because when a user watch a video, he is not interested about the other videos he liked or disliked but he is interested to be remembered if he watched, liked or disliked the current video. Very few user could watch, like and dislike enough videos to exceed the 16Mb but it could happen. But if we look at the usage pattern, a user subscribe to a channel. The list of channel is hopefully limited. Usually, users want to see un-watched video from their subscribed channel. They also have an history. They could have a recent history, say 1 month, within the user collection and the extended history in some kind of outlier pattern.

Finally {option:3} which could have all watch,like,dislike history of a user or only the older history. For older history, we could use the bucket pattern to keep one history document per month per user.

I would start simple, with {option:3} only while keeping {option:2} as a possibility. The channel subscription and the Watch-later-list would be in the user-document.