{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/comments/69323019","id":69323019,"diff_hunk":"@@ -0,0 +1,146 @@\n+// Copyright 2016 MongoDB Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+#pragma once\n+\n+#include <cereal/cereal.hpp>\n+\n+#include <bsoncxx/oid.hpp>\n+#include <mongo_odm/config/prelude.hpp>\n+#include <mongo_odm/odm_collection.hpp>\n+#include <mongocxx/collection.hpp>\n+\n+namespace mongo_odm {\n+MONGO_ODM_INLINE_NAMESPACE_BEGIN\n+\n+template <typename T, typename IdType = bsoncxx::oid>\n+class model {\n+   private:\n+// TODO: When XCode 8 is released, this can always be thread_local. Until then, the model class\n+//       will not be thread-safe on OS X.\n+#ifdef __APPLE__\n+    static odm_collection<T> _coll;\n+#else\n+    static thread_local odm_collection<T> _coll;\n+#endif\n+\n+   protected:\n+    // TODO: if IdType is bsoncxx::oid, the derived class must initialize this until CXX-940 is\n+    // resolved.\n+    // if IdType is not bsoncxx::oid, the derived class is always responsible for initializing it.\n+    IdType _id;\n+\n+   public:\n+    /**\n+     * Returns a copy of the underlying collection.\n+     * @return The mongocxx::collection that this object wraps\n+     */\n+    static mongocxx::collection collection() {","path":"src/mongo_odm/model.hpp","position":49,"original_position":49,"commit_id":"b2385207b91e2fe2a29da700efa90fec87528788","original_commit_id":"b2385207b91e2fe2a29da700efa90fec87528788","user":{"login":"Machyne","id":2737181,"avatar_url":"https://avatars.githubusercontent.com/u/2737181?v=3","gravatar_id":"","url":"https://api.github.com/users/Machyne","html_url":"https://github.com/Machyne","followers_url":"https://api.github.com/users/Machyne/followers","following_url":"https://api.github.com/users/Machyne/following{/other_user}","gists_url":"https://api.github.com/users/Machyne/gists{/gist_id}","starred_url":"https://api.github.com/users/Machyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Machyne/subscriptions","organizations_url":"https://api.github.com/users/Machyne/orgs","repos_url":"https://api.github.com/users/Machyne/repos","events_url":"https://api.github.com/users/Machyne/events{/privacy}","received_events_url":"https://api.github.com/users/Machyne/received_events","type":"User","site_admin":false},"body":"Oops, forgot that those methods weren't const. Returning a copy is good for now.","created_at":"2016-07-01T16:14:22Z","updated_at":"2016-07-01T16:14:22Z","html_url":"https://github.com/mongodb/mongo-cxx-odm/pull/7#discussion_r69323019","pull_request_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/comments/69323019"},"html":{"href":"https://github.com/mongodb/mongo-cxx-odm/pull/7#discussion_r69323019"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/7","id":75901413,"html_url":"https://github.com/mongodb/mongo-cxx-odm/pull/7","diff_url":"https://github.com/mongodb/mongo-cxx-odm/pull/7.diff","patch_url":"https://github.com/mongodb/mongo-cxx-odm/pull/7.patch","issue_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/7","number":7,"state":"open","locked":false,"title":"CXXODM-11 Add a CRTP object \"model\" base class","user":{"login":"adamchel","id":1976694,"avatar_url":"https://avatars.githubusercontent.com/u/1976694?v=3","gravatar_id":"","url":"https://api.github.com/users/adamchel","html_url":"https://github.com/adamchel","followers_url":"https://api.github.com/users/adamchel/followers","following_url":"https://api.github.com/users/adamchel/following{/other_user}","gists_url":"https://api.github.com/users/adamchel/gists{/gist_id}","starred_url":"https://api.github.com/users/adamchel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamchel/subscriptions","organizations_url":"https://api.github.com/users/adamchel/orgs","repos_url":"https://api.github.com/users/adamchel/repos","events_url":"https://api.github.com/users/adamchel/events{/privacy}","received_events_url":"https://api.github.com/users/adamchel/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-30T22:31:56Z","updated_at":"2016-07-01T16:14:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d467a83d889f4a2eb64e309d612ef5ae142091f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/7/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/7/comments","review_comment_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/7/comments","statuses_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/statuses/b2385207b91e2fe2a29da700efa90fec87528788","head":{"label":"mongodb:object_base","ref":"object_base","sha":"b2385207b91e2fe2a29da700efa90fec87528788","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","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":60376659,"name":"mongo-cxx-odm","full_name":"mongodb/mongo-cxx-odm","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","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},"private":false,"html_url":"https://github.com/mongodb/mongo-cxx-odm","description":"","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-cxx-odm","forks_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/deployments","created_at":"2016-06-03T20:45:42Z","updated_at":"2016-06-21T21:43:30Z","pushed_at":"2016-07-01T14:32:16Z","git_url":"git://github.com/mongodb/mongo-cxx-odm.git","ssh_url":"git@github.com:mongodb/mongo-cxx-odm.git","clone_url":"https://github.com/mongodb/mongo-cxx-odm.git","svn_url":"https://github.com/mongodb/mongo-cxx-odm","homepage":null,"size":367,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"mongodb:master","ref":"master","sha":"503158067798ba1f16c9b8c76674e2d3efad4f1f","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","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":60376659,"name":"mongo-cxx-odm","full_name":"mongodb/mongo-cxx-odm","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","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},"private":false,"html_url":"https://github.com/mongodb/mongo-cxx-odm","description":"","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-cxx-odm","forks_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/deployments","created_at":"2016-06-03T20:45:42Z","updated_at":"2016-06-21T21:43:30Z","pushed_at":"2016-07-01T14:32:16Z","git_url":"git://github.com/mongodb/mongo-cxx-odm.git","ssh_url":"git@github.com:mongodb/mongo-cxx-odm.git","clone_url":"https://github.com/mongodb/mongo-cxx-odm.git","svn_url":"https://github.com/mongodb/mongo-cxx-odm","homepage":null,"size":367,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/7"},"html":{"href":"https://github.com/mongodb/mongo-cxx-odm/pull/7"},"issue":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/7"},"comments":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/statuses/b2385207b91e2fe2a29da700efa90fec87528788"}}}}
{"actor":{"display_login":"Machyne"}}