Hello everyone - Should I use MongoDB for this

Hello everyone, glad to be here.
I have some experience with mongo but maybe not enough, which is maybe why I think my use case is better suited for SQL. However I am not sure, so I am seeking some advice.

I have a rather simple data structure

OneToOne
Courses -> Course_Details

OneToOne
Course_Details -> Course_Content

OneToMany 
Course_Content -> Videos

With SQL this is rather simple, but could this be something I could also in mongo implement?

Of course we would later have session management, user login token etc. This is where I start to think postgres better fits my use case.

Can anyone point me in the right direction? If I am being too vague, please let me know. I am also trying to avoid a TLDR post.

You could do this with MongoDB, something like this…create a collection called courses and have a document that represents one course

{
    "course_id": "MTH101-23",
    "course_name": "Math 101",
    "course_description": "Learn the basics of math",
    "teacher": "Bob Smith",
    "students": ["student1", "student2", "student3"],
    "videos": [
        {
            "video_name": "1. Introduction",
            "video_description": "introduction video",
            "video_location (url)": "URL of video"
    
        },
        {
            "video_name": "2. Lesson 1",
            "video_description": "Lesson one",
            "video_location (url)": "URL of video"
    
        }
    ]
}

With this model all you have to search by the course_id and you get all the information about the course. The members, teach, date, content links (videos, papers, etc).

I this looks like it could work. I will give it a shot, thanks!

1 Like