{"action":"created","issue":{"url":"https://api.github.com/repos/todda00/meteor-friendly-slugs/issues/1","labels_url":"https://api.github.com/repos/todda00/meteor-friendly-slugs/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/todda00/meteor-friendly-slugs/issues/1/comments","events_url":"https://api.github.com/repos/todda00/meteor-friendly-slugs/issues/1/events","html_url":"https://github.com/todda00/meteor-friendly-slugs/issues/1","id":56594198,"number":1,"title":"Errors throwing for existing documents - TypeError: Cannot call method 'toString' of undefined","user":{"login":"lb-","id":1396140,"avatar_url":"https://avatars.githubusercontent.com/u/1396140?v=3","gravatar_id":"","url":"https://api.github.com/users/lb-","html_url":"https://github.com/lb-","followers_url":"https://api.github.com/users/lb-/followers","following_url":"https://api.github.com/users/lb-/following{/other_user}","gists_url":"https://api.github.com/users/lb-/gists{/gist_id}","starred_url":"https://api.github.com/users/lb-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lb-/subscriptions","organizations_url":"https://api.github.com/users/lb-/orgs","repos_url":"https://api.github.com/users/lb-/repos","events_url":"https://api.github.com/users/lb-/events{/privacy}","received_events_url":"https://api.github.com/users/lb-/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-04T21:59:57Z","updated_at":"2015-02-06T15:22:39Z","closed_at":null,"body":"Hi, I just tried out this package (brilliant idea!), however I am getting this error.\r\n\r\nThe slug seems to be working, except that every time this error comes up on the server & client, it updates (I have even checked the field via Meteor Shell) but keeps throwing the errors below.\r\n\r\nHowever (with updateSlug to true) when I create a NEW document, I get no errors and slug works, even when updating the related field ('title') in this case.\r\n\r\nI would like to use this with a collection that is already in place, so please advise what I can do to help resolve this issue.\r\n\r\n### /collections/campaigns.js\r\n*Client & Server*\r\n```js\r\ndb.Campaigns = new Mongo.Collection('campaigns');\r\n// using simple schema to define a schema + I have put the field 'slug' as an optional string in the schema\r\ndb.Campaigns.attachSchema(Schemas.Campaigns);\r\n// using collection helpers to generate some other fields\r\ndb.Campaigns.helpers(Schemas.campaignHelpers);\r\ndb.Campaigns.friendlySlugs({\r\n  // I have tried the 'title' field first as this is the ideal but just tried to at least get it working with _id field, but same errors, I thought that maybe if 'title' was empty it would fail but I also checked my collection and all docs have the 'title' field\r\n  slugFrom: '_id',\r\n  slugField: 'slug',\r\n  distinct: true,\r\n  updateSlug: true,\r\n});\r\n```\r\n\r\n### Error result (server console)\r\n```bash\r\nI20150205-07:42:11.412(10)? Exception while invoking method 'updateDocument' TypeError: Cannot call method 'toString' of undefined\r\nI20150205-07:42:11.413(10)?     at slugify (packages/todda00:friendly-slugs/slugs.coffee:95:15)\r\nI20150205-07:42:11.413(10)?     at runSlug (packages/todda00:friendly-slugs/slugs.coffee:43:16)\r\nI20150205-07:42:11.413(10)?     at Object.<anonymous> (packages/todda00:friendly-slugs/slugs.coffee:38:7)\r\nI20150205-07:42:11.413(10)?     at packages/matb33:collection-hooks/update.js:41:1\r\nI20150205-07:42:11.414(10)?     at Array.forEach (native)\r\nI20150205-07:42:11.414(10)?     at Function._.each._.forEach (packages/underscore/underscore.js:105:1)\r\nI20150205-07:42:11.414(10)?     at packages/matb33:collection-hooks/update.js:40:1\r\nI20150205-07:42:11.414(10)?     at Array.forEach (native)\r\nI20150205-07:42:11.414(10)?     at Function._.each._.forEach (packages/underscore/underscore.js:105:1)\r\nI20150205-07:42:11.414(10)?     at Object.fields (packages/matb33:collection-hooks/update.js:39:1)\r\n```\r\n\r\n## Error result (client)\r\n``` console\r\nException in delivering result of invoking 'updateDocument': Error: Internal server error [500]\r\n    at _.extend._livedata_result (http://localhost:3000/packages/ddp.js?41b62dcceb3ce0de6ca79c6aed088cccde6a44d8:4925:23)\r\n    at onMessage (http://localhost:3000/packages/ddp.js?41b62dcceb3ce0de6ca79c6aed088cccde6a44d8:3723:12)\r\n    at http://localhost:3000/packages/ddp.js?41b62dcceb3ce0de6ca79c6aed088cccde6a44d8:2717:11\r\n    at Array.forEach (native)\r\n    at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:156:11)\r\n    at _.extend._launchConnection.self.socket.onmessage (http://localhost:3000/packages/ddp.js?41b62dcceb3ce0de6ca79c6aed088cccde6a44d8:2716:11)\r\n    at REventTarget.dispatchEvent (http://localhost:3000/packages/ddp.js?41b62dcceb3ce0de6ca79c6aed088cccde6a44d8:156:22)\r\n    at SockJS._dispatchMessage (http://localhost:3000/packages/ddp.js?41b62dcceb3ce0de6ca79c6aed088cccde6a44d8:1141:10)\r\n    at SockJS._didMessage (http://localhost:3000/packages/ddp.js?41b62dcceb3ce0de6ca79c6aed088cccde6a44d8:1199:18)\r\n    at WebSocket.SockJS.websocket.that.ws.onmessage (http://localhost:3000/packages/ddp.js?41b62dcceb3ce0de6ca79c6aed088cccde6a44d8:1346:17)\r\n```"},"comment":{"url":"https://api.github.com/repos/todda00/meteor-friendly-slugs/issues/comments/73252619","html_url":"https://github.com/todda00/meteor-friendly-slugs/issues/1#issuecomment-73252619","issue_url":"https://api.github.com/repos/todda00/meteor-friendly-slugs/issues/1","id":73252619,"user":{"login":"todda00","id":8363924,"avatar_url":"https://avatars.githubusercontent.com/u/8363924?v=3","gravatar_id":"","url":"https://api.github.com/users/todda00","html_url":"https://github.com/todda00","followers_url":"https://api.github.com/users/todda00/followers","following_url":"https://api.github.com/users/todda00/following{/other_user}","gists_url":"https://api.github.com/users/todda00/gists{/gist_id}","starred_url":"https://api.github.com/users/todda00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/todda00/subscriptions","organizations_url":"https://api.github.com/users/todda00/orgs","repos_url":"https://api.github.com/users/todda00/repos","events_url":"https://api.github.com/users/todda00/events{/privacy}","received_events_url":"https://api.github.com/users/todda00/received_events","type":"User","site_admin":false},"created_at":"2015-02-06T15:22:39Z","updated_at":"2015-02-06T15:22:39Z","body":"Try the latest, 0.1.2, let me know if that does any better."}}