In daily development, I usually use mysql data to store data and memcache to store cache, but I don’t know what are the advantages of nosql databases such as mongodb over mysql databases, and under what scenarios do I choose mongodb databases instead? I hope you can explain it in plain language.
To give an example:
Mysql: There are 5 fields in a table. Your program has been written, and then you need to add 2 fields here. So you go to the database to modify the table structure, add fields, then go back to the program and modify the sql code.
Mongodb: An object has 5 attributes. Your program has already been written, and then you need to add two attributes (fields) here. You can add them directly to the program, and it is OK.
In a relational database, a record is a row, a field is a column, and the data is at the intersection of the row and column. Multiple rows and multiple columns must follow the same two-dimensional structure.
Non-relational database, attributes only belong to objects. Objects are independent of each other.