Week 23: CST 363 - Introduction to Database Systems

WK07: Document Databases in Practice

This week we shifted gears to a completely different kind of database: document-oriented storage. We spent a lot of time hands-on with the most popular example - MongoDB. I'll be honest: I was nervous at first. It's brand-new for me and we had two labs to complete. I wasn't sure I'd have enough time. But it turned out simpler than I expected. Our group project that used Java to write to MongoDB felt lighter than the SQL version - no hand-writing SQL statements, no fiddly parameter assignments; you build a Java object/document and persist it. That mental model made CRUD feel very straightforward.

MongoDB vs. MySQL

MongoDB and MySQL have a lot in common: both let you create, read, update, and delete data; both use indexes (including unique ones) to speed things up; both have solid drivers and tools. The big difference is how they model data and how that feels in code. MySQL is relational: tables with fixed schemas, foreign keys, and joins. You write SQL - SELECTs, JOINs, GROUP BYs - which is great for reports and complex queries. MongoDB is document-based: JSON-like documents with flexible fields. You often embed related data in the same document and query with a JSON-style API and the Aggregation Pipeline. For scaling, MySQL often goes vertical with read replicas. MongoDB is built for horizontal sharding from the start. I would use MySQL when I need strict relationships, many-to-many models, and SQL analytics, and MongoDB when my data fits naturally into documents, or I want to move fast, or expect large, variable data and horizontal growth.

Comments

Popular posts from this blog

Week 4. Class: CST 300 - Major Pro Seminar

Week 2. Class: CST 300 - Major Pro Seminar

Week 5. Class: CST 300 - Major Pro Seminar