在我的应用程序中,我使用 node.js 和 redis 数据库。如何在 redis 中保存许多 json 对象。
db.save({
description:'sdsd',userId:'324324',url:'http://www.abc.com/abc.html',appId:'123456'
}, function (err, res) {
if(err){
console.log(err);
return;
}
else{
console.log(res);
}
});
在沙发数据库中,我们可以使用上面的代码一次又一次地将 json 对象保存为文档。如何在 redis 中执行此操作。从他们的文档中我知道下面的代码保存 json 对象
client.hmset("hosts", "mjr", "1", "another", "23", "home", "1234");
我再次想将另一个 json 对象保存在相同的“主机”中,如下所示
client.hmset("hosts", "mjr", "2", "another", "33", "home", "1235");
我怎样才能做到这一点。