Video Streaming Backend — NoSQLVerse Project
Video Streaming Backend — NoSQLVerse Project: free step-by-step lesson with examples, common mistakes, and interview tips — part of MongoDB Tutorial on Toolliyo Academy.
On this page
MongoDB Tutorial · Lesson 98 of 100
Video Streaming Backend
Foundations & CRUD ✓ → Queries & Schema ✓ → Aggregation & Scale ✓ → Atlas & Projects
Atlas & Projects · 4 — Build · ~10 min · MongoDB — Real-World Projects
What is this?
A video backend stores video metadata, manifests, watch progress, and maybe comments. The binary video files usually live in object storage (S3); MongoDB holds documents the API queries.
Why should you care?
YouTube-like apps need fast metadata queries, resume-watching, and recommendations — not BLOBs inside Mongo documents.
See it live — copy this example
Open mongosh or MongoDB Compass, select database nosqlverse, then run the example. Change one field and run again.
db.videos.insertOne({
_id: "vid-100",
title: "MongoDB Sharding Explained",
channelId: "ch-1",
durationSec: 842,
tags: ["mongodb", "sharding"],
s3Key: "videos/vid-100/master.m3u8",
publishedAt: new Date()
})
db.watchProgress.updateOne(
{ userId: "u1", videoId: "vid-100" },
{ $set: { positionSec: 120, updatedAt: new Date() } },
{ upsert: true }
)
db.videos.createIndex({ channelId: 1, publishedAt: -1 })
db.videos.find({ channelId: "ch-1" }).sort({ publishedAt: -1 }).limit(20)
db.watchProgress.findOne({ userId: "u1", videoId: "vid-100" })
Run Example »
Edit the code below and click Run to see the result in Toolliyo’s live editor.
What happened?
- videos store metadata and an S3 key to the stream.
- watchProgress upserts resume position per user/video.
- Channel pages query by channelId sorted by publishedAt.
- Media bytes stay out of Mongo.
Practice next
- Insert video metadata pointing at a fake s3Key.
- Upsert watch progress twice and confirm overwrite.
- List a channel’s videos newest first.
- Add unique index { userId: 1, videoId: 1 } on watchProgress.
- Record a views counter with $inc on videos.
Remember
Mongo = metadata + progress; object store = media. Index channel timelines. Upsert resume positions.
Course video player
NoSQLVerse lessons resume at positionSec when the learner returns.
Outcome: Completion rates rise because progress is never lost.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!