{"action":"opened","issue":{"url":"https://api.github.com/repos/KualiCo/koa-generic-session-rethinkdb/issues/2","labels_url":"https://api.github.com/repos/KualiCo/koa-generic-session-rethinkdb/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/KualiCo/koa-generic-session-rethinkdb/issues/2/comments","events_url":"https://api.github.com/repos/KualiCo/koa-generic-session-rethinkdb/issues/2/events","html_url":"https://github.com/KualiCo/koa-generic-session-rethinkdb/issues/2","id":99322976,"number":2,"title":"Documentation example is confusing","user":{"login":"thejsj","id":1981198,"avatar_url":"https://avatars.githubusercontent.com/u/1981198?v=3","gravatar_id":"","url":"https://api.github.com/users/thejsj","html_url":"https://github.com/thejsj","followers_url":"https://api.github.com/users/thejsj/followers","following_url":"https://api.github.com/users/thejsj/following{/other_user}","gists_url":"https://api.github.com/users/thejsj/gists{/gist_id}","starred_url":"https://api.github.com/users/thejsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thejsj/subscriptions","organizations_url":"https://api.github.com/users/thejsj/orgs","repos_url":"https://api.github.com/users/thejsj/repos","events_url":"https://api.github.com/users/thejsj/events{/privacy}","received_events_url":"https://api.github.com/users/thejsj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-05T23:48:54Z","updated_at":"2015-08-05T23:48:54Z","closed_at":null,"body":"First of all, thanks for doing this! This npm module seems pretty interesting. I personally don't use koa, but just wanted to make a quick suggestion to your documentation.\r\n\r\nI like the simplicity of your example, but the variable naming is a bit confusing. Let me try to explain why with comments...\r\n\r\n```\r\nvar koa = require('koa')\r\n// for use with koa-generic-session\r\nvar session = require('koa-generic-session')\r\nvar RethinkSession = require('koa-generic-session-rethinkdb')\r\n/*!\r\n * In most example of rethinkdbdash, the code used to instanstiate it is the following:\r\n * `var r = require('rethinkdbdash')();`\r\n * The fact that this is different (only by two parenthesis is already a little confusing!). \r\n * That being said, naming it to `rethinkdb` seems appropriate\r\n */\r\nvar rethinkdb = require('rethinkdbdash')\r\n\r\n/*!\r\n * What the function returned by importing `rethinkdbdash` returns is not really a connection. \r\n * It's more an instance of rethinkdbdash which actually has a connection pool, which actually \r\n * has multiple connections. Using the word connection is not totally off, but (by convention) \r\n * most people use the `r` variable here. Not using the `r` variable somehow seems to suggest that\r\n * this is different, when this is actually not.\r\n */ \r\nvar connection = rethinkdb({\r\n  host: 'localhost',\r\n  port: 28015\r\n})\r\n\r\nvar sessionStore = new RethinkSession({connection: connection})\r\n// create the db, table and indexes to store sessions\r\nsessionStore.setup()\r\n\r\nvar app = koa()\r\n// used for cookie stuffs\r\napp.keys = ['foo', 'bar']\r\n\r\napp.use(session({\r\n  store: sessionStore\r\n})\r\n```\r\n\r\nI suggest the following: \r\n```\r\nvar koa = require('koa')\r\n// for use with koa-generic-session\r\nvar session = require('koa-generic-session')\r\nvar RethinkSession = require('koa-generic-session-rethinkdb')\r\nvar r = require('rethinkdbdash')({\r\n  host: 'localhost',\r\n  port: 28015\r\n});\r\n\r\nvar sessionStore = new RethinkSession({connection: r })\r\n// create the db, table and indexes to store sessions\r\nsessionStore.setup()\r\n\r\nvar app = koa()\r\n// used for cookie stuffs\r\napp.keys = ['foo', 'bar']\r\n\r\napp.use(session({\r\n  store: sessionStore\r\n})\r\n```\r\n\r\nAgain, thanks for taking time to work on this! Just had an issue with a user who got a little confused because of the variable naming and thought others might have run into this. I might also be totally wrong about all this and missing something :). Thanks!"}}