arjunmehta / node-georedis

Super fast geo queries.
MIT License
192 stars 33 forks source link

ioredis is not working with georedis #37

Open Mohammad-Khalid95 opened 4 years ago

Mohammad-Khalid95 commented 4 years ago

I am trying to use 'ioredis' with georedis but getting error

` const Redis = require("ioredis"); const redisClient = new Redis( config.get('database').redis.port, config.get('database').redis.ip);

let geo = require('georedis').initialize(redisClient); let driverslocations = geo.addSet('abc');`

getting this ERROR ReplyError: ERR syntax error. Try GEOADD key [x1] [y1] [name1] [x2] [y2] [name2

"ioredis": "^4.17.3",
"georedis": "3.1.1",
arjunmehta commented 4 years ago

@Mohammad-Khalid95 Can you tell me which version of Redis you're using?

Never experienced this issue before, and the package has been tested with ioredis ^4.17.3.

Mohammad-Khalid95 commented 4 years ago

@arjunmehta i am also testing with ioredis ^4.17.3. can you please share an example , how to initailize geoRedis with ioredis?

arjunmehta commented 3 years ago

@Mohammad-Khalid95 You can have a look a how the tests are set up https://github.com/arjunmehta/node-georedis/blob/master/test/testIORedisNative.js

So you would do:

const IORedis = require('ioredis');
const client = new IORedis();
const georedis = require('georedis');

const geo = georedis.initialize(client, { nativeGeo: true });

This is assuming you're using a version of Redis that supports native geo queries. This is why it's helpful for me to know which version of Redis you are using.