Skip to content
Provides mongoose support for storing RegExp
JavaScript
Find file
Latest commit 1b87630 Oct 8, 2014 @aheckmann Merge pull request #1 from bendytree/patch-1
Fixed Typo In Example On Readme
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
History.md
LICENSE
Makefile
README.md
index.js
package.json

README.md

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 = doc.reg.test("MongoDB allows storing RegExps!");
    console.log(ok); // true
  });
});

install

npm install mongoose-regexp

compatibility with other languages

There are no guarantees that RegExps created and stored using another driver and retreived using this module will compile or behave the same as originally intended. This module works best when it is known that RegExps stored and retrevied were generated in Node.js.

LICENSE

Something went wrong with that request. Please try again.