Javatpoint Logo

91-9990449935

 0120-4256464

Javatpoint Logo

Redis vs MongoDB

Redis and MongoDB both are open-source NoSQL databases. Both are similar in many ways. For example: Both are released in 2009. Both are NoSQL database. Both are getting popular day by day but there are some differences between them.

Following is a list of differences between them:

Index Redis MongoDB
1) Redis is faster than MongoDB (when the stored data is small) but the API is very "atomic". MongoDB uses more resources so it is comparatively slow but the API is extremely easy to use.
2) It is hard to code in Redis database. Coding is easy in MongoDB database.
3) Redis is a key value storage. MongoDB is a document type storage.
4) Redis is not as reliable as MongoDB. It is stable from version 2.4. MongoDB is more reliable than Redis.
5) Redis database doesn't follow the conventional pattern. It is a key value storage. MongoDB is relatively more conventional. It follows document oriented structure.
6) Redis database is preferred when the data is not changing over the time and accessed very often. Otherwise MongoDB is preferred.
7) In Redis database, query is possible only by key. Indexing is possible in MongoDB so query can be done by key or by any value in the document.
8) Redis is developed by Salvatore Sanfilippo. MongoDb is developed by MongoDB Inc.
9) Redis is written and implemented in C language. MongoDB is written and implemented in C++.
10) Redis database can be used as a cache. MongoDB is a persistent database.

Advantages of Redis over MongoDB

Following are some advantages which makes Redis better than MongoDB:

  • Caching can be used with Redis database to makes query fast. While caching with MongoDB doesn't do that.
  • You should use Redis database if you have enough time for your database design.
  • Scaling is very easy in Redis.
  • Redis is well known for its performance. It is as fast as your cache because it stores data in the RAM. But, it is extremely costly and not appropriate in the case of large amount because you have to own a large RAM server.

Advantages of MongoDB over Redis

Following are some advantages where MongoDB wins:

  • MongoDB is best for rapid prototyping. Although performance is not that good but you have to define some sort of schema in your application.
  • It is also best in the case where you don?t have to change your schema quickly.
Next TopicMongoDB Tutorial




Share this page

facebook twitter google plus pinterest tumbler

Latest 4 Tutorials