I have a mongoose scheme with a virtual mixed type. For instance:
var mongoose = require('mongoose') // version 3.3.1 var FooSchema = new mongoose.Schema( { x: Number } ); FooSchema.virtual('v').set( function(value){ console.log("SETTING", value); }); var Foo = mongoose.model('Foo', FooSchema); new Foo( { v:1 } ); new Foo( { v:[] } ); new Foo( { v:{} } );
When I run this code, I get:
SETTING 1 SETTING []
As you will notice, it never shows "SETTING {}", for what reason does this not work?
Github Question Link
source share