mongoose-function

Function storage for Mongoose

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
mongoose-function
4340.1.011 years ago11 years agoMinified + gzip package size for mongoose-function in KB

Readme

mongoose-function
Provides Mongoose support for storing functions.
Build Status
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

LICENSE