LearnBoost/mongoose — Issue #682: virtual setters not called on Model instantiation when strict==true
Author: hunterloftis
Created: 2012-01-13 22:54:12+00:00
State: open

With this code:

```javascript
var Test = new server.mongoose.Schema({
email: { type: String }
}, {strict: true});

Test.virtual('photo')
.get(function() {
console.log('GETTER');
})
.set(function(v) {
console.log('SETTER');
});

var TestModel = server.mongoose.model('Test', Test);

var new_test = new TestModel({
email: 'hunter@skookum.com',
photo: 'aphoto'
});
new_test.photo = 'anotherone';

```

The setter only gets called once (/tmp/anotherone) and is not called when .photo is first set (on initialization).
If you remove {strict: true} the setter is called twice, as expected.