Reputation: 680
I am looking to use Redis as a database since it provides excellent real time data capabilities and scales better than mongo. But the data that I am using is mostly in some kind of complex json format and Redis does not easily accommodate it, given that it is primarily a key-value store.
How would I model this complex object using redis?
vacation : [
{
daysUntilVacation: 10,
vacationType: {
type: 'tropical',
media: [
{
type : 'image',
src : 'http://www.hawaii.com',
}
]
}
}
]
Upvotes: 0
Views: 354
Reputation: 49932
You're asking the wrong question - with Redis you need to begin with identifying your queries, and only afterwards can you model the data to be efficiently manipulated.
That said, you may want to look at ReJSON - a Redis module that implements a JSON data type:
(disclaimer: module's author here ;))
Upvotes: 2