Bruno Oliveira Bruno Oliveira - 6 months ago 47
Node.js Question

How to send ZRank in IOREDIS

I am new to Nodejs and I am using ioredis to send redis commands to my cluster.

I couldn't find any ioredis sample of how to use the zrank command in ioredis, except the basic 'get' and 'set' commands.

I know ioredis implemments it, but the parameters and callbacks is a mistery for me.

Thanks and sorry if the question might be duplicated.


It would be something like this. The key and the member name. If the member is not found in the key, null is returned (and other rules as in the docs here)

//redis.client established elsewhere (server startup)

redis.client.zrank( keyOfSortedSet, memberOfSortedSet )
  console.log('the rank of ' + memberOfSortedSet + ' was ' + rank );