mongoose-function
v0.1.0
Published
Function storage for Mongoose
Downloads
4,167
Readme
#mongoose-function
Provides Mongoose support for storing functions.
Example:
var mongoose = require('mongoose')
require('mongoose-function')(mongoose);
var mySchema = Schema({ func: Function });
var M = mongoose.model('Functions', mySchema);
var m = new M;
m.func = function(){
console.log('stored function')
}
m.save(function (err) {
M.findById(m._id, function (err, doc) {
doc.func(); // logs "stored function"
});
});
Storing function scope isn't supported. Just store it in a separate document property.
install
npm install mongoose-function