Redis vs MongoDB

2018-06-05

JiangRen Mr

 

Redis is an in-memory database that has been benchmarked as the fastest database in the world, while MongoDB is known for its flexibility.

 

Who Uses These Databases?

Here are a few examples of companies that use these databases:

Redis: Jet.com, Samsung, Intuit, UnitedHealthcare, Shopify, TMZ

MongoDB: The Weather Channel, eBay, Electronic Arts, Forbes, Under Armour

What About Database Structure?

Redis: In its simplest form, Redis uses key-value stores to store data with pairs of a key and an associated value. This structure is very different from relational databases that have tables featuring rows and columns, and can be difficult for some traditional SQL buffs to master.

It is probably best to show how key-value works with an example:

Let’s assume you have a list of dog calendars and you need to track the photographer along with the type of dog for each calendar so you’ll know who to contact when you need a calendar for next year.

A simple key-value pair can be represented with this format:

Dogbreed : “beagle”

Photographer : “Joe Photographer”

To retrieve the dog breed or photographer from the example above, you would need to use the GET command:

> GET Dogbreed

“beagle”

> GET Photographer

“Joe Photographer”

When you need to retrieve additional dog breeds and photographers, one way to do this is to use namespaces. With namespaces, you add a unique number after the key name that will allow you to retrieve the data.

> GET Dogbreed:1

“beagle”

>GET Dogbreed:2

“labrador”

Redis also offers more advanced data structures like lists, sorted sets, hashes, strings, sets, bitmaps, and more. Redis Modules can be used to extend these capabilities further, turning it into a JSON store, search engine, rate limiter, and much more.

MongoDB: MongoDB uses JSON-like documents to store schema-free data. In MongoDB, collections of documents do not have to have a predefined structure and columns can vary for different documents.

MongoDB has many of the features of a relational database, including an expressive query language and strong consistency. However, since it is schema-free MongoDB allows you to create documents without having to create the structure for the document first.

 

 

 

近期开课hot

Python零基础入门

start2025/02/12 03:14 (Sydney)

Web全栈班24期 NodeJS方向

start2024/12/08 11:30 (Sydney)

logo

Follow Us

linkedinfacebooktwitterinstagramweiboyoutubebilibilitiktokxigua

We Accept

/image/layout/pay-paypal.png/image/layout/pay-visa.png/image/layout/pay-master-card.png/image/layout/pay-stripe.png/image/layout/pay-alipay.png

地址

Level 10b, 144 Edward Street, Brisbane CBD(Headquarter)
Level 2, 171 La Trobe St, Melbourne VIC 3000
四川省成都市武侯区桂溪街道天府大道中段500号D5东方希望天祥广场B座45A13号
Business Hub, 155 Waymouth St, Adelaide SA 5000

Disclaimer

footer-disclaimerfooter-disclaimer

JR Academy acknowledges Traditional Owners of Country throughout Australia and recognises the continuing connection to lands, waters and communities. We pay our respect to Aboriginal and Torres Strait Islander cultures; and to Elders past and present. Aboriginal and Torres Strait Islander peoples should be aware that this website may contain images or names of people who have since passed away.

匠人学院网站上的所有内容,包括课程材料、徽标和匠人学院网站上提供的信息,均受澳大利亚政府知识产权法的保护。严禁未经授权使用、销售、分发、复制或修改。违规行为可能会导致法律诉讼。通过访问我们的网站,您同意尊重我们的知识产权。 JR Academy Pty Ltd 保留所有权利,包括专利、商标和版权。任何侵权行为都将受到法律追究。查看用户协议

© 2017-2024 JR Academy Pty Ltd. All rights reserved.

ABN 26621887572