Computer Science BS Journal (CST363) : Week 7

 This week we installed and used MongoDB. It was super new to me and I haven't really used the command prompt very much so when I was running into errors while trying to load my JavaScript file I got a bit irritated. I got it working eventually after realizing I had to move my file to a different directory and type out the full path when trying to load it. That solved all my issues. I followed the same steps when loading the other two files provided for the lab and it went smoothly. Here are some things I noticed when comparing Mongo DB with MySQL.

Similarities

  1. Database Management: Both are database management systems used to store, retrieve, and manage data.

  2. Cross-Platform: Both are cross-platform and run on Linux, Windows, and macOS.

  3. Indexing: Both support indexing for faster queries.

  4. Replication: Both support data replication for high availability.

  5. Security: Both offer authentication, authorization, and encryption features.

  6. Community and Support: Each has strong community support, robust documentation, and commercial services available.


Differences

FeatureMongoDB (NoSQL)MySQL (Relational SQL)
Data ModelDocument-based (JSON-like BSON)Table-based (rows and columns)
SchemaSchema-less or dynamic schemaRigid schema (predefined tables)
Query LanguageMongoDB Query Language (MQL)Structured Query Language (SQL)
TransactionsSupports multi-document transactions (since v4.0)ACID-compliant transactions by default
JoinsLimited support via $lookupStrong support for joins across tables
ScalabilityBuilt for horizontal scaling (sharding)Vertical scaling (with some clustering)
Use Case FitUnstructured/semi-structured dataStructured data with strong relationships
Storage FormatBSON (binary JSON)Traditional relational formats


When to Choose Each

Choose MongoDB when:

  • You need to store unstructured or semi-structured data.

  • The schema changes frequently or is undefined at design time.

  • You are building a modern web/mobile app with fast iterations.

  • Horizontal scalability is a priority (e.g., large-scale analytics, IoT, big data).

  • You're working with nested documents or arrays (e.g., catalog data, user profiles).

Choose MySQL when:

  • Data integrity and consistency are critical (banking, e-commerce).

  • You need complex queries with joins and transactions.

  • You have a well-defined schema and relationships.

  • You are using legacy systems or applications built with a traditional LAMP stack.

  • You require industry-standard tools and mature SQL support.


Summary

Use Case    Best Option
Highly structured data    MySQL
Flexible, evolving schema    MongoDB
Complex joins and transactions    MySQL
Horizontal scalability    MongoDB
Fast prototyping    MongoDB

Comments

Popular posts from this blog

Computer Science BS Journal: Week 4

Computer Science BS Journal: Week 2

Computer Science BS Journal: Week 5