I want to store a Hash object in redis but it's not working.
const UpdateStatusOfEventofMap = (eventId , status)=>{
console.log('in function eventId --->' , eventId , 'status == > ' , status)
return new Promise((resolve, reject) => {
try {
// let data = JSON.stringify(GetResponderData);
let updateEventStatus = client.hset('StatusOfEvent',eventId ,status,(err,reply)=>{
if(err) console.log(err)
resolve(reply)
})
} catch (e) {
return reject(e)
}
});
}
CodePudding user response:
use hmset instead of hset. Try this code block.
const UpdateStatusOfEventofMap = (eventId , status)=>{
console.log('in function eventId --->' , eventId , 'status == > ' , status)
return new Promise((resolve, reject) => {
try {
// let data = JSON.stringify(GetResponderData);
let updateEventStatus = client.hmset('StatusOfEvent',eventId ,status,(err,reply)=>{
if(err) console.log(err)
resolve(reply)
})
} catch (e) {
return reject(e)
}
});
}