Node redis zadd key error

I am trying to use redis sorted set command zadd. But saving the error on startup when I run this script:

var ts = Math.round(Date.now() / 1000)
      , key = 'usr::' + dest.ID + '::msgs'
      , id = uuid.v1();
var notify = {
    msg: response.msg,
    from: response.from ? response.from : null,
    type: response.type ? response.type : null,
    date: ts,
    read: 0
}
client.zadd(key, ts, JSON.stringify(notify), function (err, response) {
    if (err) throw err;
});

Is there something wrong with this code?

By the way :: what I'm trying to accomplish is a notification / incoming message system ... Therefore, it’s better to save time by asking me how you can help, and finally you won’t do this: (

ERROR: ERR operation against keystroke

+3
source share
1 answer

I would say that the key already exists in Redis and is not sortable. Try to see if you have usr :: ID :: msgs entries in Redis and check their type.

Update:

, , .

:

1) , , , , . , Lua script , .

2) : , , - . (HMSET).

3) ( , ). .

, , .

+2

All Articles