{"action":"created","issue":{"url":"https://api.github.com/repos/luin/ioredis/issues/124","labels_url":"https://api.github.com/repos/luin/ioredis/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/luin/ioredis/issues/124/comments","events_url":"https://api.github.com/repos/luin/ioredis/issues/124/events","html_url":"https://github.com/luin/ioredis/issues/124","id":99756936,"number":124,"title":"duplicate() does not duplicate index selection","user":{"login":"jasonkuhrt","id":284476,"avatar_url":"https://avatars.githubusercontent.com/u/284476?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonkuhrt","html_url":"https://github.com/jasonkuhrt","followers_url":"https://api.github.com/users/jasonkuhrt/followers","following_url":"https://api.github.com/users/jasonkuhrt/following{/other_user}","gists_url":"https://api.github.com/users/jasonkuhrt/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonkuhrt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonkuhrt/subscriptions","organizations_url":"https://api.github.com/users/jasonkuhrt/orgs","repos_url":"https://api.github.com/users/jasonkuhrt/repos","events_url":"https://api.github.com/users/jasonkuhrt/events{/privacy}","received_events_url":"https://api.github.com/users/jasonkuhrt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-08T01:10:25Z","updated_at":"2015-08-08T13:45:20Z","closed_at":null,"body":"These two clients will be accessing different redis indexes:\r\n\r\n```js\r\nlet redis = Redis.createClient()\r\nredis.select(5)\r\n\r\nlet redis2 = redis.duplicate() // This client is using the default index, rather than 5!\r\n```\r\n\r\nThis was surprising to me. Is there a good justification for this?"},"comment":{"url":"https://api.github.com/repos/luin/ioredis/issues/comments/128982463","html_url":"https://github.com/luin/ioredis/issues/124#issuecomment-128982463","issue_url":"https://api.github.com/repos/luin/ioredis/issues/124","id":128982463,"user":{"login":"luin","id":635902,"avatar_url":"https://avatars.githubusercontent.com/u/635902?v=3","gravatar_id":"","url":"https://api.github.com/users/luin","html_url":"https://github.com/luin","followers_url":"https://api.github.com/users/luin/followers","following_url":"https://api.github.com/users/luin/following{/other_user}","gists_url":"https://api.github.com/users/luin/gists{/gist_id}","starred_url":"https://api.github.com/users/luin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luin/subscriptions","organizations_url":"https://api.github.com/users/luin/orgs","repos_url":"https://api.github.com/users/luin/repos","events_url":"https://api.github.com/users/luin/events{/privacy}","received_events_url":"https://api.github.com/users/luin/received_events","type":"User","site_admin":false},"created_at":"2015-08-08T13:45:20Z","updated_at":"2015-08-08T13:45:20Z","body":"Hi, `Redis#duplicate` only duplicates the options of the Redis. For example the following code should work:\r\n\r\n```\r\nlet redis = new Redis({ db: 5 })\r\nlet redis2 = redis.duplicate()\r\n```\r\n\r\nRelated code: https://github.com/luin/ioredis/blob/master/lib/redis.js#L318"}}