mongoose-regexp
v0.0.1
Published
Adds RegExp storage support to Mongoose
Downloads
2,015
Readme
#mongoose-regexp
Provides Mongoose support for storing RegExp
.
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