KevsRobots Learning Platform
By Kevin McAleer, 7 Minutes
Page last updated October 18, 2026

Picture the parts drawer in your workshop. Somewhere in there are three SG90 servos, a motor driver you bought “just in case”, and a bag of M3 screws that is definitely nearly empty. You know roughly what is in there, but answering a simple question like “how many servos do I have?” means tipping the whole thing out on the bench.
A database is the cure for that. Let’s look at what one actually is before we start typing commands.
A database is an organised collection of information, plus the software that looks after it. That second part matters. The software:
A question you send to a database is called a query. You will be writing a lot of those in this course.
Fair question. Plenty of makers track their parts in a spreadsheet or a text file, and for a dozen items that works fine. Things start to creak as soon as you want more:
| Text file | Spreadsheet | Database | |
|---|---|---|---|
| Easy to start | Yes | Yes | A little setup |
| Fast with thousands of items | No | Slows down | Yes |
| Several programs using it at once | Risky | Risky | Built for it |
| Your own code can ask it questions | You write the searching | Awkward | Yes, that is the point |
| Each item can have different details | Messy | Every row has the same columns | Yes, with MongoDB |
The big one for makers is the fourth row. A robot logging sensor readings, a web page showing your stock, and a Python script reordering parts can all talk to the same database at the same time without tripping over each other.
Databases like MongoDB work as a server and a client.
mongosh (MongoDB’s command line shell) and, later, a Python script.Think of a café. The kitchen (server) has all the food. Customers (clients) walk up to the counter and order. Lots of customers can order at once, and none of them need to know how the kitchen is laid out.
The server and client can be on the same computer, which is how we will start, or on opposite sides of the world.
MongoDB is a popular, free-to-use database first released in 2009. The name comes from “humongous”, because it was designed to handle huge amounts of data. We will use the free Community Edition (and optionally the free tier of MongoDB’s cloud service, Atlas).
You will often hear MongoDB described with two phrases.
SQL (often said “sequel”) is the language used by relational databases, which store data in tables of rows and columns, a bit like a strict spreadsheet. NoSQL means “not only SQL” and is a catch-all name for databases that store data some other way. If you are curious about the table-based world, our SQLite course is a gentle introduction, but you don’t need it for this course.
MongoDB is a document database. Instead of spreading a part across rows and columns, it stores each part as one self-contained document, a bit like an index card with everything about that part written on it:
{
name: "SG90 Micro Servo",
category: "servo",
quantity: 12,
tags: ["servo", "5v", "smars"]
}
Everything about the servo, including its list of tags, lives together on one card. We will pick this apart properly in the next lesson.
All over the place, because documents map so neatly onto the objects programs already work with:
For us, it is a great fit for a workshop full of parts that are all a little bit different. A servo has a torque rating, a battery has a capacity, and a screw has neither.
Throughout this course we will build the Parts Bin, a database that tracks every part in a maker’s workshop: servos, sensors, boards, motor drivers, batteries and screws.
workshoppartsparts_bin.py, that can add parts, find them, mark them as used, restock them and warn you when you are running lowEvery example in the course uses this same data, so by the end you will have a genuinely useful tool for your own bench.
No commands yet, just a bit of thinking.
Problem: “Do I need to learn SQL first?”
Solution: No. MongoDB does not use SQL at all. Everything in this course is self-contained.
Why: MongoDB has its own way of writing queries, using the same document shape as the data itself.
Problem: “Is the server a separate computer I need to buy?”
Solution: No. The server is just a program. We will run it on the computer you already have.
Why: “Server” describes a role (the thing that answers requests), not a type of hardware.
workshop database with a parts collectionNext up, we will look closely at documents and collections and learn to read the format MongoDB uses.
You can use the arrows ← → on your keyboard to navigate between lessons.
Comments