mongoose-function

Function storage for Mongoose

#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 (errdoc) {
    doc.func(); // logs "stored function" 
  });
});

Storing function scope isn't supported. Just store it in a separate document property.

npm install mongoose-function

LICENSE