0.1.0 • Published 11 years ago

mongoose-function v0.1.0

Weekly downloads
438
License
-
Repository
github
Last release
11 years ago

#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