In a world where more and more data is being stored in the cloud, it is becoming increasingly important to take the correct measures when deciding what type of database to use. Each type will come with different security measures which need to be taken.
A Powerful Relational Database
MySQL is currently the most popular database system on the internet, and is fully open source. It has a relational structure which means that tables are able to be linked via primary and foreign keys, to share data with one another. This comes in useful for when a shop has different categories, and multiple products within sub categories. It allows for a product to be linked directly to a categories table and view the data, without having to repeat any information.
MySQL is venerable on the front-end of sites to SQL injection attacks, in which someone will input a special code, and if not handled correctly when doing validation by the website, it is possible for hackers to gain access to the full database, and see its contents, or manipulate the values for their own gain. Despite this, when all precautions are taken correctly, in most cases MySQL is the database system of choice for most websites.
An excellent choice for high volume datasets
MongoDB is a non-relational database used primarily for high volume and large datasets. Instead of using tables and rows, MongoDB makes use of collections and documents. Documents consist of key-value pairs which are equivalent to a row and row name in MySQL. Collections contain sets of documents and function which is the equivalent of relational database tables.
The advantage to using MongoDB is that when developing, it is accessed and written more like traditional code, making it easier to understand and layout. For large databases, MongoDB is able to scale as and when it is needed, by adding more nodes which can access and write/read data. However this does come at a cost of using a lot of memory for storing and accessing the database, and in larger systems this can require its own server alone. There are less security issues with MongoDB as the user can not directly interact with any of the handling, which may be possible in MySQL, making it more secure and easier to work with on the back-end requiring more checks.