{"action":"opened","number":141,"pull_request":{"url":"https://api.github.com/repos/go-mgo/mgo/pulls/141","id":40936633,"html_url":"https://github.com/go-mgo/mgo/pull/141","diff_url":"https://github.com/go-mgo/mgo/pull/141.diff","patch_url":"https://github.com/go-mgo/mgo/pull/141.patch","issue_url":"https://api.github.com/repos/go-mgo/mgo/issues/141","number":141,"state":"open","locked":false,"title":"bson: reading json struct tag if bson tag is missing","user":{"login":"mcuadros","id":1573114,"avatar_url":"https://avatars.githubusercontent.com/u/1573114?v=3","gravatar_id":"","url":"https://api.github.com/users/mcuadros","html_url":"https://github.com/mcuadros","followers_url":"https://api.github.com/users/mcuadros/followers","following_url":"https://api.github.com/users/mcuadros/following{/other_user}","gists_url":"https://api.github.com/users/mcuadros/gists{/gist_id}","starred_url":"https://api.github.com/users/mcuadros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcuadros/subscriptions","organizations_url":"https://api.github.com/users/mcuadros/orgs","repos_url":"https://api.github.com/users/mcuadros/repos","events_url":"https://api.github.com/users/mcuadros/events{/privacy}","received_events_url":"https://api.github.com/users/mcuadros/received_events","type":"User","site_admin":false},"body":"This is a very small PR but for sure very controversial, the goal is try to avoid add more tags to the fields, reading the `json` struct tag if the `bson` one is missing. \r\n\r\nI am pretty sure that many projects using mgo and having also json serialzable structs, are like: \r\n```go\r\ntype Person struct {\r\n\tName              string `bson:\",omitempty\" json:\",omitempty\"`\r\n\tFullName          string `bson:\"full_name,omitempty\" json:\"full_name,omitempty\"`\r\n\tDescription       string `bson:\",omitempty\" json:\",omitempty\"`\r\n}\r\n``` \r\n\r\nThis is really annoying because in many cases is expected to have the same snake cases names in a json and also in the mongo document, also could be a source of bugs due to the requirement of the duplicate tags.\r\n","created_at":"2015-07-27T18:55:37Z","updated_at":"2015-07-27T18:55:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/go-mgo/mgo/pulls/141/commits","review_comments_url":"https://api.github.com/repos/go-mgo/mgo/pulls/141/comments","review_comment_url":"https://api.github.com/repos/go-mgo/mgo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/go-mgo/mgo/issues/141/comments","statuses_url":"https://api.github.com/repos/go-mgo/mgo/statuses/7ff925259f4f895326f09289bc1a643d318a55f2","head":{"label":"mcuadros:json-tag","ref":"json-tag","sha":"7ff925259f4f895326f09289bc1a643d318a55f2","user":{"login":"mcuadros","id":1573114,"avatar_url":"https://avatars.githubusercontent.com/u/1573114?v=3","gravatar_id":"","url":"https://api.github.com/users/mcuadros","html_url":"https://github.com/mcuadros","followers_url":"https://api.github.com/users/mcuadros/followers","following_url":"https://api.github.com/users/mcuadros/following{/other_user}","gists_url":"https://api.github.com/users/mcuadros/gists{/gist_id}","starred_url":"https://api.github.com/users/mcuadros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcuadros/subscriptions","organizations_url":"https://api.github.com/users/mcuadros/orgs","repos_url":"https://api.github.com/users/mcuadros/repos","events_url":"https://api.github.com/users/mcuadros/events{/privacy}","received_events_url":"https://api.github.com/users/mcuadros/received_events","type":"User","site_admin":false},"repo":{"id":39791520,"name":"mgo","full_name":"mcuadros/mgo","owner":{"login":"mcuadros","id":1573114,"avatar_url":"https://avatars.githubusercontent.com/u/1573114?v=3","gravatar_id":"","url":"https://api.github.com/users/mcuadros","html_url":"https://github.com/mcuadros","followers_url":"https://api.github.com/users/mcuadros/followers","following_url":"https://api.github.com/users/mcuadros/following{/other_user}","gists_url":"https://api.github.com/users/mcuadros/gists{/gist_id}","starred_url":"https://api.github.com/users/mcuadros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcuadros/subscriptions","organizations_url":"https://api.github.com/users/mcuadros/orgs","repos_url":"https://api.github.com/users/mcuadros/repos","events_url":"https://api.github.com/users/mcuadros/events{/privacy}","received_events_url":"https://api.github.com/users/mcuadros/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcuadros/mgo","description":"The MongoDB driver for Go. See http://labix.org/mgo for details.","fork":true,"url":"https://api.github.com/repos/mcuadros/mgo","forks_url":"https://api.github.com/repos/mcuadros/mgo/forks","keys_url":"https://api.github.com/repos/mcuadros/mgo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcuadros/mgo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcuadros/mgo/teams","hooks_url":"https://api.github.com/repos/mcuadros/mgo/hooks","issue_events_url":"https://api.github.com/repos/mcuadros/mgo/issues/events{/number}","events_url":"https://api.github.com/repos/mcuadros/mgo/events","assignees_url":"https://api.github.com/repos/mcuadros/mgo/assignees{/user}","branches_url":"https://api.github.com/repos/mcuadros/mgo/branches{/branch}","tags_url":"https://api.github.com/repos/mcuadros/mgo/tags","blobs_url":"https://api.github.com/repos/mcuadros/mgo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcuadros/mgo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcuadros/mgo/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcuadros/mgo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcuadros/mgo/statuses/{sha}","languages_url":"https://api.github.com/repos/mcuadros/mgo/languages","stargazers_url":"https://api.github.com/repos/mcuadros/mgo/stargazers","contributors_url":"https://api.github.com/repos/mcuadros/mgo/contributors","subscribers_url":"https://api.github.com/repos/mcuadros/mgo/subscribers","subscription_url":"https://api.github.com/repos/mcuadros/mgo/subscription","commits_url":"https://api.github.com/repos/mcuadros/mgo/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcuadros/mgo/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcuadros/mgo/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcuadros/mgo/issues/comments{/number}","contents_url":"https://api.github.com/repos/mcuadros/mgo/contents/{+path}","compare_url":"https://api.github.com/repos/mcuadros/mgo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcuadros/mgo/merges","archive_url":"https://api.github.com/repos/mcuadros/mgo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcuadros/mgo/downloads","issues_url":"https://api.github.com/repos/mcuadros/mgo/issues{/number}","pulls_url":"https://api.github.com/repos/mcuadros/mgo/pulls{/number}","milestones_url":"https://api.github.com/repos/mcuadros/mgo/milestones{/number}","notifications_url":"https://api.github.com/repos/mcuadros/mgo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcuadros/mgo/labels{/name}","releases_url":"https://api.github.com/repos/mcuadros/mgo/releases{/id}","created_at":"2015-07-27T18:40:59Z","updated_at":"2015-07-27T18:41:00Z","pushed_at":"2015-07-27T18:42:14Z","git_url":"git://github.com/mcuadros/mgo.git","ssh_url":"git@github.com:mcuadros/mgo.git","clone_url":"https://github.com/mcuadros/mgo.git","svn_url":"https://github.com/mcuadros/mgo","homepage":"","size":6736,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"v2-unstable"}},"base":{"label":"go-mgo:v2-unstable","ref":"v2-unstable","sha":"85f82c52963e2601eb5d1a87e8c98cc7f4f1e27b","user":{"login":"go-mgo","id":6823674,"avatar_url":"https://avatars.githubusercontent.com/u/6823674?v=3","gravatar_id":"","url":"https://api.github.com/users/go-mgo","html_url":"https://github.com/go-mgo","followers_url":"https://api.github.com/users/go-mgo/followers","following_url":"https://api.github.com/users/go-mgo/following{/other_user}","gists_url":"https://api.github.com/users/go-mgo/gists{/gist_id}","starred_url":"https://api.github.com/users/go-mgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/go-mgo/subscriptions","organizations_url":"https://api.github.com/users/go-mgo/orgs","repos_url":"https://api.github.com/users/go-mgo/repos","events_url":"https://api.github.com/users/go-mgo/events{/privacy}","received_events_url":"https://api.github.com/users/go-mgo/received_events","type":"Organization","site_admin":false},"repo":{"id":21898301,"name":"mgo","full_name":"go-mgo/mgo","owner":{"login":"go-mgo","id":6823674,"avatar_url":"https://avatars.githubusercontent.com/u/6823674?v=3","gravatar_id":"","url":"https://api.github.com/users/go-mgo","html_url":"https://github.com/go-mgo","followers_url":"https://api.github.com/users/go-mgo/followers","following_url":"https://api.github.com/users/go-mgo/following{/other_user}","gists_url":"https://api.github.com/users/go-mgo/gists{/gist_id}","starred_url":"https://api.github.com/users/go-mgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/go-mgo/subscriptions","organizations_url":"https://api.github.com/users/go-mgo/orgs","repos_url":"https://api.github.com/users/go-mgo/repos","events_url":"https://api.github.com/users/go-mgo/events{/privacy}","received_events_url":"https://api.github.com/users/go-mgo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/go-mgo/mgo","description":"The MongoDB driver for Go. See http://labix.org/mgo for details.","fork":false,"url":"https://api.github.com/repos/go-mgo/mgo","forks_url":"https://api.github.com/repos/go-mgo/mgo/forks","keys_url":"https://api.github.com/repos/go-mgo/mgo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/go-mgo/mgo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/go-mgo/mgo/teams","hooks_url":"https://api.github.com/repos/go-mgo/mgo/hooks","issue_events_url":"https://api.github.com/repos/go-mgo/mgo/issues/events{/number}","events_url":"https://api.github.com/repos/go-mgo/mgo/events","assignees_url":"https://api.github.com/repos/go-mgo/mgo/assignees{/user}","branches_url":"https://api.github.com/repos/go-mgo/mgo/branches{/branch}","tags_url":"https://api.github.com/repos/go-mgo/mgo/tags","blobs_url":"https://api.github.com/repos/go-mgo/mgo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/go-mgo/mgo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/go-mgo/mgo/git/refs{/sha}","trees_url":"https://api.github.com/repos/go-mgo/mgo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/go-mgo/mgo/statuses/{sha}","languages_url":"https://api.github.com/repos/go-mgo/mgo/languages","stargazers_url":"https://api.github.com/repos/go-mgo/mgo/stargazers","contributors_url":"https://api.github.com/repos/go-mgo/mgo/contributors","subscribers_url":"https://api.github.com/repos/go-mgo/mgo/subscribers","subscription_url":"https://api.github.com/repos/go-mgo/mgo/subscription","commits_url":"https://api.github.com/repos/go-mgo/mgo/commits{/sha}","git_commits_url":"https://api.github.com/repos/go-mgo/mgo/git/commits{/sha}","comments_url":"https://api.github.com/repos/go-mgo/mgo/comments{/number}","issue_comment_url":"https://api.github.com/repos/go-mgo/mgo/issues/comments{/number}","contents_url":"https://api.github.com/repos/go-mgo/mgo/contents/{+path}","compare_url":"https://api.github.com/repos/go-mgo/mgo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/go-mgo/mgo/merges","archive_url":"https://api.github.com/repos/go-mgo/mgo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/go-mgo/mgo/downloads","issues_url":"https://api.github.com/repos/go-mgo/mgo/issues{/number}","pulls_url":"https://api.github.com/repos/go-mgo/mgo/pulls{/number}","milestones_url":"https://api.github.com/repos/go-mgo/mgo/milestones{/number}","notifications_url":"https://api.github.com/repos/go-mgo/mgo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/go-mgo/mgo/labels{/name}","releases_url":"https://api.github.com/repos/go-mgo/mgo/releases{/id}","created_at":"2014-07-16T11:36:46Z","updated_at":"2015-07-27T11:35:48Z","pushed_at":"2015-07-27T18:55:37Z","git_url":"git://github.com/go-mgo/mgo.git","ssh_url":"git@github.com:go-mgo/mgo.git","clone_url":"https://github.com/go-mgo/mgo.git","svn_url":"https://github.com/go-mgo/mgo","homepage":"","size":6736,"stargazers_count":451,"watchers_count":451,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":129,"mirror_url":null,"open_issues_count":30,"forks":129,"open_issues":30,"watchers":451,"default_branch":"v2-unstable"}},"_links":{"self":{"href":"https://api.github.com/repos/go-mgo/mgo/pulls/141"},"html":{"href":"https://github.com/go-mgo/mgo/pull/141"},"issue":{"href":"https://api.github.com/repos/go-mgo/mgo/issues/141"},"comments":{"href":"https://api.github.com/repos/go-mgo/mgo/issues/141/comments"},"review_comments":{"href":"https://api.github.com/repos/go-mgo/mgo/pulls/141/comments"},"review_comment":{"href":"https://api.github.com/repos/go-mgo/mgo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/go-mgo/mgo/pulls/141/commits"},"statuses":{"href":"https://api.github.com/repos/go-mgo/mgo/statuses/7ff925259f4f895326f09289bc1a643d318a55f2"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":13,"deletions":0,"changed_files":2}}