i am new one for redis today only i have stared to work on this. i have inserted data into redis by done like this
var data = {
"name": "XXXxxx",
"email": "xxxxx@gmail.com"
}
db.set('userdetails', JSON.stringify(data), function (err, result) {
console.log(result);
});
it inserted fine but when i try to insert new data i could view my newly inserted data but i could not view previously inserted data . how to insert multiple json data by using only one key(userdetails)? is there possible to create data structure like this?
userdetails:
[
{
"name": "xxxxxxxxxxxxxx",
"email": "xxxxxx@gmail.com"
}, {
"name": "xxxxxxxxxx",
"email": "xxxxxxx@gmail.com"
}, {
"name": "xxxxxx",
"email": "xxxxxxxxx@gmail.com"
}
]
Take a look at Redis queue (or set), maybe it's what you want to do (http://redis.io/topics/data-types)