{"action":"created","issue":{"url":"https://api.github.com/repos/siegesmund/SwiftDDP/issues/52","repository_url":"https://api.github.com/repos/siegesmund/SwiftDDP","labels_url":"https://api.github.com/repos/siegesmund/SwiftDDP/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/siegesmund/SwiftDDP/issues/52/comments","events_url":"https://api.github.com/repos/siegesmund/SwiftDDP/issues/52/events","html_url":"https://github.com/siegesmund/SwiftDDP/issues/52","id":162988965,"number":52,"title":"Should a subscription have _id be default?","user":{"login":"wkniffin","id":10079417,"avatar_url":"https://avatars.githubusercontent.com/u/10079417?v=3","gravatar_id":"","url":"https://api.github.com/users/wkniffin","html_url":"https://github.com/wkniffin","followers_url":"https://api.github.com/users/wkniffin/followers","following_url":"https://api.github.com/users/wkniffin/following{/other_user}","gists_url":"https://api.github.com/users/wkniffin/gists{/gist_id}","starred_url":"https://api.github.com/users/wkniffin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wkniffin/subscriptions","organizations_url":"https://api.github.com/users/wkniffin/orgs","repos_url":"https://api.github.com/users/wkniffin/repos","events_url":"https://api.github.com/users/wkniffin/events{/privacy}","received_events_url":"https://api.github.com/users/wkniffin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-29T18:01:15Z","updated_at":"2016-06-29T19:20:24Z","closed_at":null,"body":"Hey!\r\nI am subscribing to a publication and trying to get the _id of the doc. I could not see it in there without _id included in the fields of the publication or with _id included in the fields. \r\n\r\nAny thoughts?"},"comment":{"url":"https://api.github.com/repos/siegesmund/SwiftDDP/issues/comments/229460371","html_url":"https://github.com/siegesmund/SwiftDDP/issues/52#issuecomment-229460371","issue_url":"https://api.github.com/repos/siegesmund/SwiftDDP/issues/52","id":229460371,"user":{"login":"Sef1995","id":3214653,"avatar_url":"https://avatars.githubusercontent.com/u/3214653?v=3","gravatar_id":"","url":"https://api.github.com/users/Sef1995","html_url":"https://github.com/Sef1995","followers_url":"https://api.github.com/users/Sef1995/followers","following_url":"https://api.github.com/users/Sef1995/following{/other_user}","gists_url":"https://api.github.com/users/Sef1995/gists{/gist_id}","starred_url":"https://api.github.com/users/Sef1995/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sef1995/subscriptions","organizations_url":"https://api.github.com/users/Sef1995/orgs","repos_url":"https://api.github.com/users/Sef1995/repos","events_url":"https://api.github.com/users/Sef1995/events{/privacy}","received_events_url":"https://api.github.com/users/Sef1995/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T19:20:24Z","updated_at":"2016-06-29T19:20:24Z","body":"You have to override the init method. The _id field is being set via the init method of the super class MeteorDocument. As an example check out the following code:\r\n\r\n```\r\nimport Foundation\r\nimport SwiftDDP\r\n\r\nclass JobDocument : MeteorDocument {\r\n    \r\n    var _id: String?\r\n    var type: String?\r\n    var data: [String: AnyObject]?\r\n    var status: String?\r\n    \r\n    required init(id: String, fields: NSDictionary?) {\r\n        super.init(id: id, fields: fields)\r\n        \r\n        self._id = id\r\n    }\r\n    \r\n    override func update(fields: NSDictionary?, cleared: [String]?) {\r\n        super.update(fields, cleared: cleared)\r\n    }\r\n    \r\n    override func setValue(value: AnyObject?, forKey key: String) {\r\n        if (key == \"type\") {\r\n            self.type = value as? String\r\n        }\r\n        \r\n        if (key == \"data\") {\r\n            self.data = value as? [String: AnyObject]\r\n        }\r\n        \r\n        if (key == \"status\") {\r\n            self.status = value as? String\r\n        }\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"Sef1995"}}