{"action":"created","issue":{"url":"https://api.github.com/repos/LearnBoost/mongoose/issues/2782","labels_url":"https://api.github.com/repos/LearnBoost/mongoose/issues/2782/labels{/name}","comments_url":"https://api.github.com/repos/LearnBoost/mongoose/issues/2782/comments","events_url":"https://api.github.com/repos/LearnBoost/mongoose/issues/2782/events","html_url":"https://github.com/LearnBoost/mongoose/issues/2782","id":63728153,"number":2782,"title":"document#set(obj) doesn't work if obj is a sub doc","user":{"login":"artiifix","id":6806011,"avatar_url":"https://avatars.githubusercontent.com/u/6806011?v=3","gravatar_id":"","url":"https://api.github.com/users/artiifix","html_url":"https://github.com/artiifix","followers_url":"https://api.github.com/users/artiifix/followers","following_url":"https://api.github.com/users/artiifix/following{/other_user}","gists_url":"https://api.github.com/users/artiifix/gists{/gist_id}","starred_url":"https://api.github.com/users/artiifix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artiifix/subscriptions","organizations_url":"https://api.github.com/users/artiifix/orgs","repos_url":"https://api.github.com/users/artiifix/repos","events_url":"https://api.github.com/users/artiifix/events{/privacy}","received_events_url":"https://api.github.com/users/artiifix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-23T13:54:14Z","updated_at":"2015-03-23T16:47:30Z","closed_at":null,"body":"My schema is similar to the following:\r\n```js\r\nlet schema = new mongoose.schema({\r\n  confirmation: {\r\n    data: {\r\n      email: String\r\n    }\r\n  }\r\n});\r\n```\r\n\r\nI also have a User model, which is updated with data from the above schema:\r\n```js\r\nuser.set(this.get('confirmation.data')); // `user.email` won't be changed\r\n```\r\nBut this doesn't work (there is now change to the user document). Meanwhile, if make `confirmation.data` of type Mixed, it works:\r\n```js\r\nlet schema = new mongoose.schema({\r\n  confirmation: {\r\n    data: mongoose.Schema.Types.Mixed\r\n  }\r\n});\r\n// ...\r\nconsole.log(this.get('confirmation.data')); // { email: 'some@example.com' }\r\nuser.set(this.get('confirmation.data')); // This works just fine\r\n```\r\nAnother strange behaviour: Setting strict mode to false leads to none of the above examples working:\r\n```js\r\nlet schema = new mongoose.schema({\r\n  confirmation: {\r\n    data: mongoose.Schema.Types.Mixed\r\n  }\r\n});\r\nuser.set(this.get('confirmation.data'), { strict: false }); // This won't work\r\n```\r\nBy the way, I'm using version `4.0.0-rc4`.\r\nShould I write a test for it? Maybe, I could also try to work out a fix if you want me to."},"comment":{"url":"https://api.github.com/repos/LearnBoost/mongoose/issues/comments/85090005","html_url":"https://github.com/LearnBoost/mongoose/issues/2782#issuecomment-85090005","issue_url":"https://api.github.com/repos/LearnBoost/mongoose/issues/2782","id":85090005,"user":{"login":"vkarpov15","id":1620265,"avatar_url":"https://avatars.githubusercontent.com/u/1620265?v=3","gravatar_id":"","url":"https://api.github.com/users/vkarpov15","html_url":"https://github.com/vkarpov15","followers_url":"https://api.github.com/users/vkarpov15/followers","following_url":"https://api.github.com/users/vkarpov15/following{/other_user}","gists_url":"https://api.github.com/users/vkarpov15/gists{/gist_id}","starred_url":"https://api.github.com/users/vkarpov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkarpov15/subscriptions","organizations_url":"https://api.github.com/users/vkarpov15/orgs","repos_url":"https://api.github.com/users/vkarpov15/repos","events_url":"https://api.github.com/users/vkarpov15/events{/privacy}","received_events_url":"https://api.github.com/users/vkarpov15/received_events","type":"User","site_admin":false},"created_at":"2015-03-23T16:47:30Z","updated_at":"2015-03-23T16:47:30Z","body":"What does your user schema look like? A test would be helpful."}}