Unexpected behavior
I have some model:
//test.js 
var mongoose = require('../utils/mongoose'); 
var schema1 = new mongoose.Schema({ name: String }) 
var schema2 = new mongoose.Schema({ objectsArray: [schema1] }); 
schema1.pre('validate', function(next) { 
    console.log('pre validate schema1'); 
    next(); 
}); 
module.exports = mongoose.model('Schema2', schema2);
Do save:
var o = new require('test')({ objectsArray: [{ name: 'Alex' }] }); 
o.save(function(err){ console.log('saved'); });
After, in console i get:
pre validate schema1 pre validate schema1 savedThe question is, Why?schema1.pre('validate')- appears 2 times, but i expect 1 time?
--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/groups/opt_out.