我想插入註釋在redis中用HSET作爲首選選項,但出現錯誤。 下面是代碼:Nodejs Redis HSET&HGET插入到數據集錯誤
var commmentData ={
id : id,
comment : req.body.comment,
postId : req.body.postId,
userId : req.body.userId
}
redisClient.hset('comment', commmentData, function(err, reply) {
if (err) throw err;
console.log("Reply : "+ reply);
res.json(errorResponse.res.SaveSuccess);
});
我仍然HMSET或置角,其中之一應使用之間的無能。
看起來你需要HMSET - 的「M」是倍數,如在哈希設置多個領域。這就像爲不同的領域多次做HMSET一樣。 –
確實插入解決方案resame,我必須以stringify格式存儲所有內容?如下所示: redisClient.hmset('comment',JSON.stringify(commmentData),function(err,reply){if }); –