A fleeting glance between MongoDB and Redis
Storage
MongoDB
Disk, memory-mapped files, index should fit in RAM.
Redis
Typically in-memory.
Data model
MongoDB
Document oriented, JSON-like. Each document has unique key within a collection. Documents are heterogenous.
Redis
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
Querying
MongoDB
By key, by any value in document, Map/Reduce.
Redis
By key

