{"action":"opened","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/5111","repository_url":"https://api.github.com/repos/Automattic/mongoose","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/5111/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/5111/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/5111/events","html_url":"https://github.com/Automattic/mongoose/issues/5111","id":216788452,"number":5111,"title":"strict: false option on Model#update no effect..?","user":{"login":"MidnightP","id":22522186,"avatar_url":"https://avatars3.githubusercontent.com/u/22522186?v=3","gravatar_id":"","url":"https://api.github.com/users/MidnightP","html_url":"https://github.com/MidnightP","followers_url":"https://api.github.com/users/MidnightP/followers","following_url":"https://api.github.com/users/MidnightP/following{/other_user}","gists_url":"https://api.github.com/users/MidnightP/gists{/gist_id}","starred_url":"https://api.github.com/users/MidnightP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MidnightP/subscriptions","organizations_url":"https://api.github.com/users/MidnightP/orgs","repos_url":"https://api.github.com/users/MidnightP/repos","events_url":"https://api.github.com/users/MidnightP/events{/privacy}","received_events_url":"https://api.github.com/users/MidnightP/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-24T13:40:16Z","updated_at":"2017-03-24T13:40:16Z","closed_at":null,"body":"<!-- *Before creating an issue please make sure you are using the latest version of mongoose -->\r\n\r\nMy models do not have the strict option on them so by default strict is true. I want to store fields, some of which are defined in the schema, and some of which are not. So I presume to use `strict: false`, like so:\r\n\r\n```\r\nconst options = { \r\n                upsert: true,\r\n\t\trunValidators: false,\r\n                strict: false }\r\n\r\nconst data = { field_one: 'blablabla', field_two: 'blablalblalblalbl' }\r\n\r\nModel.update({_id: _id}, data, options, cb)\r\n```\r\n\r\nNow, `field_one` is in the schema, `field_two` is not. When I look at the document using a `.find` or using MongoChef, i see that the field is not there!\r\n\r\nTemporarily brutal solution:\r\n\r\n1) `Model.schema.options.strict = false`\r\n2) perform update\r\n3) `Model.schema.options.strict = true` \r\n\r\n**Do you want to request a *feature* or report a *bug*?**\r\n\r\nI think so.\r\n\r\n**What is the current behavior?**\r\n\r\n`vin` & `definitions` are not saved\r\n\r\n**What is the expected behavior?**\r\n\r\nOverriding the strict option of the schema!\r\n\r\n**Please mention your node.js, mongoose and MongoDB version.**\r\n\r\nMongoose @4.9.0\r\nNode @7.6.0\r\nMongodb@2.2.4\r\n\r\nI'm running mongodb in Docker with image `mongo:3.4`\r\n"}}
{"actor":{"display_login":"MidnightP"}}