Node-redis: hmset no longer support object?

Created on 27 Dec 2016  ·  4Comments  ·  Source: NodeRedis/node-redis

  • Version: 2.6.3
  • Platform: Node 6.6 osx
  • Description: Using hmset to set an oject
    getting this:
node_redis: Deprecated: The HMSET command contains a argument of type Object.
This is converted to "[object Object]" by using .toString() now and will return an error from v.3.0 on.

but the documentation says nothing about it, can you please either support it or remove it from the docs, it's very confusing...
how do you suggest we do that from now on?
thanks

question

Most helpful comment

@id0Sch the object is a nested Object and this is not supported.
hmset takes a key plus n * field, value. But everything has to be a primitive. The key, each field and each value. Only those can be saved properly.

So using:

// works fine
client.hmset('key', { test: 'works for me', route: 66 })
// does not work:
client.hmset('key', { test: { broken: true }, route: 66 })

All 4 comments

@id0Sch the object is a nested Object and this is not supported.
hmset takes a key plus n * field, value. But everything has to be a primitive. The key, each field and each value. Only those can be saved properly.

So using:

// works fine
client.hmset('key', { test: 'works for me', route: 66 })
// does not work:
client.hmset('key', { test: { broken: true }, route: 66 })

oh ok, it makes more sense now,
thanks!

Oh. mama mia, why don't just implemented linear probing?

This no longer accepts an object, whats the best way now?

Was this page helpful?
0 / 5 - 0 ratings