{"action":"created","issue":{"url":"https://api.github.com/repos/vdemedes/mongorito/issues/84","repository_url":"https://api.github.com/repos/vdemedes/mongorito","labels_url":"https://api.github.com/repos/vdemedes/mongorito/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/vdemedes/mongorito/issues/84/comments","events_url":"https://api.github.com/repos/vdemedes/mongorito/issues/84/events","html_url":"https://github.com/vdemedes/mongorito/issues/84","id":122702004,"number":84,"title":"Add usage examples","user":{"login":"kulakowka","id":557190,"avatar_url":"https://avatars.githubusercontent.com/u/557190?v=3","gravatar_id":"","url":"https://api.github.com/users/kulakowka","html_url":"https://github.com/kulakowka","followers_url":"https://api.github.com/users/kulakowka/followers","following_url":"https://api.github.com/users/kulakowka/following{/other_user}","gists_url":"https://api.github.com/users/kulakowka/gists{/gist_id}","starred_url":"https://api.github.com/users/kulakowka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kulakowka/subscriptions","organizations_url":"https://api.github.com/users/kulakowka/orgs","repos_url":"https://api.github.com/users/kulakowka/repos","events_url":"https://api.github.com/users/kulakowka/events{/privacy}","received_events_url":"https://api.github.com/users/kulakowka/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vdemedes/mongorito/labels/docs","name":"docs","color":"207de5"},{"url":"https://api.github.com/repos/vdemedes/mongorito/labels/help%20wanted","name":"help wanted","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-12-17T10:05:26Z","updated_at":"2016-03-01T20:42:34Z","closed_at":null,"body":"@vdemedes can you add a simple koa-application example?"},"comment":{"url":"https://api.github.com/repos/vdemedes/mongorito/issues/comments/190892274","html_url":"https://github.com/vdemedes/mongorito/issues/84#issuecomment-190892274","issue_url":"https://api.github.com/repos/vdemedes/mongorito/issues/84","id":190892274,"user":{"login":"dcsan","id":514002,"avatar_url":"https://avatars.githubusercontent.com/u/514002?v=3","gravatar_id":"","url":"https://api.github.com/users/dcsan","html_url":"https://github.com/dcsan","followers_url":"https://api.github.com/users/dcsan/followers","following_url":"https://api.github.com/users/dcsan/following{/other_user}","gists_url":"https://api.github.com/users/dcsan/gists{/gist_id}","starred_url":"https://api.github.com/users/dcsan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcsan/subscriptions","organizations_url":"https://api.github.com/users/dcsan/orgs","repos_url":"https://api.github.com/users/dcsan/repos","events_url":"https://api.github.com/users/dcsan/events{/privacy}","received_events_url":"https://api.github.com/users/dcsan/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T20:42:34Z","updated_at":"2016-03-01T20:42:34Z","body":"```js\r\n'use strict';\r\n\r\nconst co = require('co');\r\nconst mongorito = require('mongorito');\r\n\r\n/*\r\n * Run a generator function and print errors if any\r\n */\r\nfunction run (fn) {\r\n\tco(fn).catch(function (err) {\r\n\t\tconsole.error(err.stack);\r\n\t});\r\n}\r\n\r\nfunction connect() {\r\n\trun(function * () {\r\n\t\tconsole.log('connecting');\r\n\t\tyield mongorito.connect('localhost/mongorito-test');\r\n\t\tconsole.log('connecting DONE');\r\n\t});\r\n}\r\n\r\nfunction disconnect() {\r\n\trun(function * () {\r\n\t\tyield mongorito.disconnect();\r\n\t\tconsole.log('disconnected');\r\n\t});\r\n}\r\n\r\nconst Model = mongorito.Model;\r\nclass Tags extends Model {}\r\n\r\nvar tag = new Tags({\r\n\ttitle: 'cool-stuff',\r\n\tbody: 'info about this tag'\r\n});\r\n\r\nfunction* main() {\r\n\tconsole.log('main');\r\n\tyield connect();\r\n\tyield tag.save();\r\n\tconsole.log('saved');\r\n}\r\n\r\nrun(main() );\r\n```"}}