{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/comments/243116134","pull_request_review_id":186799725,"id":243116134,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzExNjEzNA==","diff_hunk":"@@ -3,17 +3,74 @@ import Foundation\n /// `BSONDecoder` facilitates the decoding of BSON into semantic `Decodable` types.\n public class BSONDecoder {\n \n+    @available(OSX 10.12, *)\n+    internal static var iso8601Formatter: ISO8601DateFormatter = {\n+        let formatter = ISO8601DateFormatter()\n+        formatter.formatOptions = .withInternetDateTime\n+        return formatter\n+    }()\n+\n+    /// Enum representing the different options for decoding `Date`s from BSON\n+    public enum DateDecodingStrategy {\n+        /// Decoding `Date`s stored as 64 bit integers counting the number of milliseconds since January 1, 1970\n+        case millisecondsSince1970Int64","path":"Sources/MongoSwift/BSON/BSONDecoder.swift","position":null,"original_position":14,"commit_id":"affe96e0bc6c4c63560a3baa367b3036ef64bbc9","original_commit_id":"4a433618eaa80d8f4f173495412fa4b69bcf894d","user":{"login":"patrickfreed","id":936020,"node_id":"MDQ6VXNlcjkzNjAyMA==","avatar_url":"https://avatars0.githubusercontent.com/u/936020?v=4","gravatar_id":"","url":"https://api.github.com/users/patrickfreed","html_url":"https://github.com/patrickfreed","followers_url":"https://api.github.com/users/patrickfreed/followers","following_url":"https://api.github.com/users/patrickfreed/following{/other_user}","gists_url":"https://api.github.com/users/patrickfreed/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickfreed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickfreed/subscriptions","organizations_url":"https://api.github.com/users/patrickfreed/orgs","repos_url":"https://api.github.com/users/patrickfreed/repos","events_url":"https://api.github.com/users/patrickfreed/events{/privacy}","received_events_url":"https://api.github.com/users/patrickfreed/received_events","type":"User","site_admin":false},"body":"I think I originally wanted to preserve dates that could fit in an `Int64` but not in a `Double`, but at the end of the day they're all going into a `Date` which holds `Double`s.\r\n\r\nAnyways, done.","created_at":"2018-12-19T23:49:48Z","updated_at":"2018-12-19T23:49:48Z","html_url":"https://github.com/mongodb/mongo-swift-driver/pull/176#discussion_r243116134","pull_request_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/176","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/comments/243116134"},"html":{"href":"https://github.com/mongodb/mongo-swift-driver/pull/176#discussion_r243116134"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/176"}},"in_reply_to_id":243073289},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/176","id":239948611,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5OTQ4NjEx","html_url":"https://github.com/mongodb/mongo-swift-driver/pull/176","diff_url":"https://github.com/mongodb/mongo-swift-driver/pull/176.diff","patch_url":"https://github.com/mongodb/mongo-swift-driver/pull/176.patch","issue_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues/176","number":176,"state":"open","locked":false,"title":"SWIFT-281 Allow .uuidDecodingStrategy and .dateDecodingStrategy to be set for BSONDecoder","user":{"login":"patrickfreed","id":936020,"node_id":"MDQ6VXNlcjkzNjAyMA==","avatar_url":"https://avatars0.githubusercontent.com/u/936020?v=4","gravatar_id":"","url":"https://api.github.com/users/patrickfreed","html_url":"https://github.com/patrickfreed","followers_url":"https://api.github.com/users/patrickfreed/followers","following_url":"https://api.github.com/users/patrickfreed/following{/other_user}","gists_url":"https://api.github.com/users/patrickfreed/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickfreed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickfreed/subscriptions","organizations_url":"https://api.github.com/users/patrickfreed/orgs","repos_url":"https://api.github.com/users/patrickfreed/repos","events_url":"https://api.github.com/users/patrickfreed/events{/privacy}","received_events_url":"https://api.github.com/users/patrickfreed/received_events","type":"User","site_admin":false},"body":"[SWIFT-281](https://jira.mongodb.org/browse/SWIFT-281)\r\n\r\nThis PR adds two options for specifying a `DateDecodingStrategy` and a `UUIDDecodingStrategy` on a given `BSONDecoder`. \r\n\r\nFor `Date`, I mimicked the functionality of `JSONDecoder`'s [strategies](https://developer.apple.com/documentation/foundation/jsondecoder/datedecodingstrategy), and I also added versions which expect the date to be stored as `Int64` (instead of `Double`/`TimeInterval`). The default strategy is `.millisecondsSince1970Int64` as per the BSON spec.\r\n\r\nFor `UUID`, I added the following strategies:\r\n\r\n- `.defferredToUUID`: uses `UUID`'s implementation of `init(from: decoder)`\r\n- `.fromString`: decodes from a UUID string (should be the same as `.deferredToUUID`)\r\n- `.fromBinary`: decodes from a BSON binary type\r\n\r\nThe default is `.fromBinary` as per the encoding in #162 .\r\n\r\nThe ticket mentions changing the decoder from `public` to `open`, but I didn't see why that is necessary. Openness really just means the class can subclassed / its properties and functions can be overridden outside of the MongoSwift module. Does the introduction of these strategies necessitate that?","created_at":"2018-12-19T19:26:23Z","updated_at":"2018-12-19T23:49:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd897d55438d36ae52bcbe77902ff3d6c42590e9","assignee":null,"assignees":[],"requested_reviewers":[{"login":"mbroadst","id":312966,"node_id":"MDQ6VXNlcjMxMjk2Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/312966?v=4","gravatar_id":"","url":"https://api.github.com/users/mbroadst","html_url":"https://github.com/mbroadst","followers_url":"https://api.github.com/users/mbroadst/followers","following_url":"https://api.github.com/users/mbroadst/following{/other_user}","gists_url":"https://api.github.com/users/mbroadst/gists{/gist_id}","starred_url":"https://api.github.com/users/mbroadst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbroadst/subscriptions","organizations_url":"https://api.github.com/users/mbroadst/orgs","repos_url":"https://api.github.com/users/mbroadst/repos","events_url":"https://api.github.com/users/mbroadst/events{/privacy}","received_events_url":"https://api.github.com/users/mbroadst/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/176/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/176/comments","review_comment_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues/176/comments","statuses_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/statuses/affe96e0bc6c4c63560a3baa367b3036ef64bbc9","head":{"label":"mongodb:SWIFT-281","ref":"SWIFT-281","sha":"affe96e0bc6c4c63560a3baa367b3036ef64bbc9","user":{"login":"mongodb","id":45120,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1MTIw","avatar_url":"https://avatars1.githubusercontent.com/u/45120?v=4","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":118030974,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgwMzA5NzQ=","name":"mongo-swift-driver","full_name":"mongodb/mongo-swift-driver","private":false,"owner":{"login":"mongodb","id":45120,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1MTIw","avatar_url":"https://avatars1.githubusercontent.com/u/45120?v=4","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mongodb/mongo-swift-driver","description":"The Swift driver for MongoDB","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-swift-driver","forks_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/deployments","created_at":"2018-01-18T19:55:11Z","updated_at":"2018-12-19T03:32:42Z","pushed_at":"2018-12-19T23:48:24Z","git_url":"git://github.com/mongodb/mongo-swift-driver.git","ssh_url":"git@github.com:mongodb/mongo-swift-driver.git","clone_url":"https://github.com/mongodb/mongo-swift-driver.git","svn_url":"https://github.com/mongodb/mongo-swift-driver","homepage":"","size":8153,"stargazers_count":62,"watchers_count":62,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":15,"open_issues":8,"watchers":62,"default_branch":"master"}},"base":{"label":"mongodb:master","ref":"master","sha":"06b8f46665209c55d53f85b5da68d8d1301a78c2","user":{"login":"mongodb","id":45120,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1MTIw","avatar_url":"https://avatars1.githubusercontent.com/u/45120?v=4","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":118030974,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgwMzA5NzQ=","name":"mongo-swift-driver","full_name":"mongodb/mongo-swift-driver","private":false,"owner":{"login":"mongodb","id":45120,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1MTIw","avatar_url":"https://avatars1.githubusercontent.com/u/45120?v=4","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mongodb/mongo-swift-driver","description":"The Swift driver for MongoDB","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-swift-driver","forks_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/mongo-swift-driver/deployments","created_at":"2018-01-18T19:55:11Z","updated_at":"2018-12-19T03:32:42Z","pushed_at":"2018-12-19T23:48:24Z","git_url":"git://github.com/mongodb/mongo-swift-driver.git","ssh_url":"git@github.com:mongodb/mongo-swift-driver.git","clone_url":"https://github.com/mongodb/mongo-swift-driver.git","svn_url":"https://github.com/mongodb/mongo-swift-driver","homepage":"","size":8153,"stargazers_count":62,"watchers_count":62,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":15,"open_issues":8,"watchers":62,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/176"},"html":{"href":"https://github.com/mongodb/mongo-swift-driver/pull/176"},"issue":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues/176"},"comments":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/issues/176/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/176/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/pulls/176/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongo-swift-driver/statuses/affe96e0bc6c4c63560a3baa367b3036ef64bbc9"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"patrickfreed"}}