Script Valley
MongoDB: Complete Course
MongoDB Foundations/Assessment

Practice & Assessment

Test your understanding of MongoDB Foundations

Multiple Choice Questions

5
1

What is the maximum size of a single MongoDB document?

2

Which component of an ObjectId encodes the document's creation time?

3

In MongoDB schema design, when should you prefer embedding over referencing?

4

What does BSON add over standard JSON?

5

When you run 'use newDB' in mongosh and then exit without inserting any documents, what happens?

Coding Challenges

1
1

Design a Schema for a Blog Platform

Given a blog platform with users, posts, and comments: design two MongoDB schemas — one fully embedded and one fully referenced. Write the document structure as JavaScript objects (no live DB needed). Then write a 3-sentence justification for which schema you would use in production and why. Your output must show both schemas and the justification. Constraints: posts can have up to 500 comments, a user can have thousands of posts. Estimated time: 20 minutes.

Easy

Mini Project

1

Local MongoDB Explorer CLI

Build a Node.js CLI script that connects to a local MongoDB instance, lists all databases, lets the user pick one interactively, then lists its collections and prints the first 3 documents from a chosen collection in formatted JSON. Use the official mongodb npm driver (no Mongoose). The script must handle connection errors gracefully and close the connection on exit. Concepts used: connection strings, mongosh equivalents in code, BSON document output, collection introspection.

Easy