What are the differences between MongoDB and Redis?
Just looking for what people see as the main differences when choosing between the two.
Document oriented, JSON-like. Each document has unique key within a collection. Documents are heterogenous.
Key-value, values are:
- Lists of strings
- Sets of strings (collections of non-repeating unsorted elements)
- Sorted sets of strings (collections of non-repeating elements ordered by a floating-point number called score)
- Hashes where keys are strings and values are either strings or integers
Disk, memory-mapped files, index should fit in RAM.
By key, by any value in document (indexing possible), Map/Reduce.
I just read a comparison between different NOSQL databases which I think sums it up pretty nicely:
Best used: If you need dynamic queries. If you prefer to define indexes, not map/reduce functions. If you need good performance on a big DB. If you wanted CouchDB, but your data changes too much, filling up disks.
Best used: For rapidly changing data with a foreseeable database size (should fit mostly in memory).
Redis is a key value store while mongofb is a document store.
Redis is awesome at storing unrelated pieces of information while mongodb is awesome at structuring or modeling information with relations between them.
I sm not talking in absolute ways. They are both nosql databases and as such you can pretty much define the shape and colour of what you store but in practice, that is how they are usually used.