MongoDB:
1) Document Database
MongoDB adopts bson for documentation. For example, you can design blog articles and comments as follows:
{'Id': 1, 'author': 'ningoo ', 'title': 'vernacular MongoDB (1)', 'content': 'according to the official statement, 10 thousand words are omitted here, comment: [{'comment-author': 'song bingjia ', 'comment-content': 'wood you'}, {'comment-author ': 'nyma', 'comment-content': 'Sorry, '}]}
Like a structure above, a document is equivalent to a row of records in a relational database. Multiple documents form a collection, which is equivalent to a table in a relational database.
Multiple collections are logically organized together, that is, databases. A MongoDB instance supports multiple databases ).
This structure leads to a large storage overhead, and the size of data stored in 1 GB is several GB.
2) B + Tree Index
redis:
Redis is essentially a key-value type memory database, similar to memcached. The entire database is loaded into the memory for operations,
Regularly flush database data to the hard disk for storage through asynchronous operations. Because it is a pure memory operation, redis has excellent performance,
The biggest charm of redis is that it supports saving the data structure of list linked lists and set sets, and also supports various operations on List, such as pushing and POP data from both ends of list,
Returns the list range, sorting, and so on. Set supports the Union and intersection operations of various sets. In addition, the maximum value of a single value is 1 GB,
Unlike memcached, which can only store 1 MB of data, redis can be used to implement many useful functions, such as using its list as a FIFO two-way linked list,
Implement a lightweight high-performance Message Queue Service, and use its set to implement a high-performance tag system. In addition, redis can also
Key-value can be used as an enhanced memcached.
1) Key and value Databases
2) hash index data, data operations in the memory (supporting application-level VMS), and regular implementation.