Week 7 - MongoDB
Compare MongoDB with MySQL.
What are some similarities?
Both MongoDB and MySQL are designed as database management systems that are designed to retrieve, modify, manage, and store data. They both offer ways to interact with the database as they allow it to perform operations for creating, reading, inserting, updating and deleting data. An important similarity is that they both may utilize indexes as a way to offer efficient search. Though in MongoDB the user would need to define the indexes in the shell or else it will initiate a collection scan for all the documents. They both offer ways to operate queries with their own query operators such as in MySQL you may utilize sql operators =, != <>, >, >=, <, <= and IN, while MongoDB utilizes mql operators such as $eg, $ne, $gt, $gte, $lt, $lte, and $in. Lastly, I would note that both have a way to manage users and security systems, and have a replication system to maintain copies of data.
What are some differences?
The differences between MongoDB and MySQL comes from their basic structure, MongoDB is a document database which utilizes document database storage as collections of documents.On the other hand MySQL is a relational database which utilizes tables and organizes data in rows and columns. Both utilize their own query language as MySQL uses sql and MongoDB may use MQL. MySQL operates by creating schemas to structure the data while the latter stores data in JSON-like documents called BSON to create collections of documents. Within a collection, documents can have fields and attributes with flexibility; the flexibility comes from the fields having their own attributes. MongoDB functions through better horizontal scaling through its ability in sharding which involves having data across multiple computing systems or servers. While MySQL relies more on vertical scaling which involves having more computing resources in a single machine to handle more power from upgrading CPU, ram and storage devices. MySQL relies heavily on complex queries which involve query joins and subqueries while MongoDB does not as it involves storing related data within a single document.
When would you choose one over the other?
MySQL would be chosen over MongoDB through situations where complex relationships occur. For Example, a system for course registrations which involves handling data among different entities like courses, departments, students, timeslots, semesters, and much more. MySQL would handle the relationships between these entities much better than MongoDB since it would be able to utilize joins to operate its queries. MongoDB would be best used for storing created profiles from gaming apps, social media apps and many other account creation applications. The reason is that MongoDB would be able to handle personal preferences and maintain flexible fields. For Example, if a user changes their profile to have a certain language or add another preference such as preferring a windowed display, these fields would be added to the document without affecting others. In MySQL this would require schema changes and additional modifications which would make the process complicated and slow.
What are some similarities?
Both MongoDB and MySQL are designed as database management systems that are designed to retrieve, modify, manage, and store data. They both offer ways to interact with the database as they allow it to perform operations for creating, reading, inserting, updating and deleting data. An important similarity is that they both may utilize indexes as a way to offer efficient search. Though in MongoDB the user would need to define the indexes in the shell or else it will initiate a collection scan for all the documents. They both offer ways to operate queries with their own query operators such as in MySQL you may utilize sql operators =, != <>, >, >=, <, <= and IN, while MongoDB utilizes mql operators such as $eg, $ne, $gt, $gte, $lt, $lte, and $in. Lastly, I would note that both have a way to manage users and security systems, and have a replication system to maintain copies of data.
What are some differences?
The differences between MongoDB and MySQL comes from their basic structure, MongoDB is a document database which utilizes document database storage as collections of documents.On the other hand MySQL is a relational database which utilizes tables and organizes data in rows and columns. Both utilize their own query language as MySQL uses sql and MongoDB may use MQL. MySQL operates by creating schemas to structure the data while the latter stores data in JSON-like documents called BSON to create collections of documents. Within a collection, documents can have fields and attributes with flexibility; the flexibility comes from the fields having their own attributes. MongoDB functions through better horizontal scaling through its ability in sharding which involves having data across multiple computing systems or servers. While MySQL relies more on vertical scaling which involves having more computing resources in a single machine to handle more power from upgrading CPU, ram and storage devices. MySQL relies heavily on complex queries which involve query joins and subqueries while MongoDB does not as it involves storing related data within a single document.
When would you choose one over the other?
MySQL would be chosen over MongoDB through situations where complex relationships occur. For Example, a system for course registrations which involves handling data among different entities like courses, departments, students, timeslots, semesters, and much more. MySQL would handle the relationships between these entities much better than MongoDB since it would be able to utilize joins to operate its queries. MongoDB would be best used for storing created profiles from gaming apps, social media apps and many other account creation applications. The reason is that MongoDB would be able to handle personal preferences and maintain flexible fields. For Example, if a user changes their profile to have a certain language or add another preference such as preferring a windowed display, these fields would be added to the document without affecting others. In MySQL this would require schema changes and additional modifications which would make the process complicated and slow.
Comments
Post a Comment