{"action":"opened","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/3032","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/3032/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/3032/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/3032/events","html_url":"https://github.com/Automattic/mongoose/issues/3032","id":82610411,"number":3032,"title":"Setters on Array items not executed","user":{"login":"dhritzkiv","id":1349865,"avatar_url":"https://avatars.githubusercontent.com/u/1349865?v=3","gravatar_id":"","url":"https://api.github.com/users/dhritzkiv","html_url":"https://github.com/dhritzkiv","followers_url":"https://api.github.com/users/dhritzkiv/followers","following_url":"https://api.github.com/users/dhritzkiv/following{/other_user}","gists_url":"https://api.github.com/users/dhritzkiv/gists{/gist_id}","starred_url":"https://api.github.com/users/dhritzkiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhritzkiv/subscriptions","organizations_url":"https://api.github.com/users/dhritzkiv/orgs","repos_url":"https://api.github.com/users/dhritzkiv/repos","events_url":"https://api.github.com/users/dhritzkiv/events{/privacy}","received_events_url":"https://api.github.com/users/dhritzkiv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-29T22:22:09Z","updated_at":"2015-05-29T22:22:09Z","closed_at":null,"body":"I may be interacting with arrays incorrectly, but I can't seem to get the setters on array items to fire upon insertion or upon saving, after an initial initialization.\r\n\r\n````javascript\r\nvar schema = new mongoose.Schema({\r\n    arrayField: [\r\n        {\r\n            type: String,\r\n            lowercase: true\r\n        }\r\n    ]\r\n});\r\n\r\nvar Model = mongoose.model(\"foobar\", schema);\r\n\r\nvar doc = new Model({\r\n    arrayField: [\"ONE\", \"TWO\"]\r\n});\r\n//doc now has two values, and they were lowercased, as expected.\r\n//{\r\n//    arrayField: [\"one\", \"two\"]\r\n//}\r\n\r\ndoc.arrayField.push(\"THREE\");\r\n//doc now has three values, but the newly inserted one is not lowercased\r\n//{\r\n//    arrayField: [\"one\", \"two\", \"THREE\"]\r\n//}\r\n\r\ndoc.save(function(err, model) {\r\n   //doc.arrayField still has the third value as uppercase; the setters on the new values haven't been executed.\r\n   //{\r\n   //    arrayField: [\"one\", \"two\", \"THREE\"]\r\n   //}\r\n});\r\n````\r\n\r\nI've tried various ways of affecting the array: `doc.markModified(\"arrayField.2\")`, `doc.set(\"arrayField.2\", \"THREE\")`; but it's still the same result.\r\n\r\nApologies if this is a known issue. I couldn't find it by searching.\r\n\r\nMongoose v4.0.4 on io.js 2.1.0"}}