npm.io
0.0.1 • Published 13 years ago

mongoose-regexp

Licence
MIT
Version
0.0.1
Deps
0
Vulns
0
Weekly
0
Stars
14
DeprecatedThis package is deprecated

#mongoose-regexp =================

Provides Mongoose support for storing RegExp.

Build Status

Example:

var mongoose = require('mongoose')
require('mongoose-regexp')(mongoose);

var mySchema = Schema({ reg: RegExp });
var M = mongoose.model('RegExp', mySchema);

var m = new M;
m.reg = /^mongodb/i;
m.save(function (err) {
  M.findById(m._id, function (err, doc) {
    var ok = m.reg.test("MongoDB allows storing RegExps!");
    console.log(ok); // true
  });
});

install

npm install mongoose-regexp

LICENSE

Keywords