StaffCoder
MongoDB

MongoDB Practice Exercises

Java 25Node.js 24Python 3.13
1 module · 4 challengesSign up
Module 1 of 1 · 4 challenges

Documents, BSON & CRUD Basics

Move records into a collection and keep their types intact: store documents one at a time and in bulk, hold money, timestamps and identifiers as the BSON types they need, and read every field back unchanged.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

First Documents

Sign up to unlock
33%1 of 3 solvedeasy
About this challenge

Move customer records out of JSON files on a shared drive and into a MongoDB collection: store them one at a time and in a batch, read each one back by its identifier, let the server mint the identifier a record arrives without, count them by filter and in total, and remove them one at a time and in bulk.

Solved in a browser IDE and graded by tests. Sign up to solve

BSON Types and Precision

Sign up to unlock
100%1 of 1 solvedeasy
About this challenge

Move invoices out of exported spreadsheet rows and into a MongoDB collection where every value keeps the type it is meant to have: money that adds up to the cent, issue times that mean the same moment whatever zone they were written in, customer identifiers another client writes byte for byte the same way, and counter readings in the integer widths they were given.

Solved in a browser IDE and graded by tests. Sign up to solve

Ordered & Unordered Bulk Inserts

Sign up to unlock
100%1 of 1 solvedeasy
About this challenge

Load the nightly product batches into a collection keyed by SKU in one bulk operation instead of a line-at-a-time loop, in the mode that stops at the first duplicate SKU and in the mode that carries on past it, and turn what the load reports back - including the positions it refused - into an import report of how many products landed and which SKUs were rejected.

Solved in a browser IDE and graded by tests. Sign up to solve

Product Catalogue Loader

STAR
Solving it completes the module
100%1 of 1 solvedeasy
About this challenge

Turn supplier feeds of mixed quality into a product catalogue: map every feed line to a document whose prices are exact, whose listing times mean the same moment whatever zone the supplier is in and whose supplier identifiers another client writes byte for byte the same way, load a feed in a mode that stops at the first duplicate article number and in a mode that carries on past it, report which lines were refused and where, reconcile the stored catalogue against the feed per supplier, and discontinue a supplier.

Solved in a browser IDE and graded by tests. Sign up to solve

About this path

Master MongoDB from your first document to production - documents and BSON types, query filters and projections, updates, arrays, indexes, aggregation, transactions, replication and sharding, all tested against a real deployment. Choose Java, Node.js or Python.

This path starts with documents, BSON types and inserts, the ground every MongoDB query builds on. You work through a MongoDB driver in Java, Node.js or Python, so you should be able to write a small program in one of them. No earlier MongoDB experience is needed. The first module ends with a product catalogue loader that stores prices, dates and ids without losing precision.

From the blog

2

Frequently asked questions

4

What will I practice in this path?

1 module: Documents, BSON & CRUD Basics.

How many MongoDB exercises are there, and how hard are they?

4 exercises, all easy.

What does this path run on?

You can work in Java 25, Node.js 24 or Python 3.13.

Do I need to install anything?

No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.