Created
April 19, 2013 21:35
-
-
Save asalant/5423400 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set mixed { '0': { name: 'Foo' }, | |
'1': | |
{ path: 'mixed', | |
instance: undefined, | |
validators: [], | |
setters: [ [Function] ], | |
getters: [], | |
options: { type: [Function: Mixed] }, | |
_index: null } } | |
Set mixed { '0': 'Bar', | |
'1': | |
{ path: 'mixed', | |
instance: undefined, | |
validators: [], | |
setters: [ [Function] ], | |
getters: [], | |
options: { type: [Function: Mixed] }, | |
_index: null } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose'); | |
var schema = new mongoose.Schema({ | |
mixed: {type: mongoose.Schema.Types.Mixed} | |
}); | |
schema.path('mixed').set(function (data) { | |
console.log("Set mixed", arguments); | |
return data; | |
}); | |
var TestModel = mongoose.model('TestModel', schema); | |
var obj = new TestModel({mixed: { name: 'Foo'}}); | |
obj.set('mixed.name', 'Bar'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment