Database
We maintain a persistent data store.
All data safely on MongoDB Atlas.
All read/write operations must have the correct authentication token.
Data Model
Diagram coming soon!
Collection Schemas
1. Users
We use the users
collection to track all details about a user.
However, we do not authenticate users through our database, as that would be insecure. 👍
export interface UserDocument extends Document {
firstName: string
lastName: string
username: string
email: string
password: string
birthDate: Date
registrationDate: Date
lastLoginDate: Date
profilePicture: string
onBoardingStatus: string
emailVerificationCode: number
isAdmin: boolean
comparePassword(candidatePassword: string): Promise<boolean>
}
2. Clips
The clips
collection tracks clips metadata, allowing users to see
and engage with video proxies before starting to stream the video.
It also provides the streaming endpoint for the video.
export interface ClipMetadataDocument extends Document {
videoId: mongoose.Types.ObjectId
title: string
description: string
uploadDate: Date
uploader: mongoose.Types.ObjectId
duration: number
thumbnailURL: string
clipURL: string
views: mongoose.Types.ObjectId[]
likes: mongoose.Types.ObjectId[]
dislikes: mongoose.Types.ObjectId[]
}
3. Comments
The comments
collection tracks comments and replies on videos,
allowing users to share their sentiments about videos.
export interface CommentDocument extends Document {
userId: mongoose.Types.ObjectId
videoId: mongoose.Types.ObjectId
clipId: mongoose.Types.ObjectId | null
text: string
likes: mongoose.Types.ObjectId[]
nestedComments: mongoose.Types.ObjectId[]
isReply: boolean
}
4. Recommendations
The recommendations
collection tracks which videos are in the recommended queue for a given user,
allowing the front-end to prefetch metadata and even prerender the next video while the user is still
watching the current video.
This reduces buffering, providing a smoother user experience.
export interface PrecomputedRecommendationsDocument extends Document {
userId: mongoose.Types.ObjectId
topicSequences: Map<string, mongoose.Types.ObjectId[]>
}
5. Relationships
The relationships
collection tracks relationshipts between users,
allowing users to connect with others and share content.
Annoying users can also be blocked.
export interface RelationshipDocument extends Document {
fromUserID: mongoose.Types.ObjectId
toUserID: mongoose.Types.ObjectId
status: 'pending' | 'accepted' | 'declined' | 'blocked'
initiatedDate: Date
updatedDate: Date
}
6. Topics
The topics
collection tracks all topics and subtopics in our ecosystem,
allowing us to organize videos effectively, and efficiently direct users through learning paths.
export interface TopicMetadataDocument extends Document {
combinedTopicName: string
topicName: string
subTopicName: string | undefined
description: string
thumbnailURL: string
}
7. User Affinities
The user-affinities
collection tracks user affinities to topics,
depending on how much they have engaged with videos in that topic,
and the sentiments reflected in their feedback.
export interface UserAffinityDocument extends Document {
userId: mongoose.Types.ObjectId
affinities: Map<mongoose.Types.ObjectId, number>
}
8. Video Affinities
The video-affinities
collection tracks video affinities to topics,
depending on how much each video aligns with the topic.
This is because certain videos might be aligned with multiple topics.
export interface VideoAffinityDocument extends Document {
videoId: mongoose.Types.ObjectId
affinities: Map<mongoose.Types.ObjectId, number>
}
9. Video Metadata
The video-metadata
collection tracks all metadata individual long-form videos
and which clips were extracted from each specific video.
We recognize that clips from the same video might be related.
export interface VideoMetadataDocument extends Document {
title: string
description: string
uploadDate: Date
uploader: mongoose.Types.ObjectId
duration: number
thumbnailURL: string
topicId: mongoose.Types.ObjectId
clips: mongoose.Types.ObjectId[]
views: mongoose.Types.ObjectId[]
likes: mongoose.Types.ObjectId[]
dislikes: mongoose.Types.ObjectId[]
}