Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mongoosejs/mongoose-regexp
Provides mongoose support for storing RegExp
https://github.com/mongoosejs/mongoose-regexp
Last synced: 3 months ago
JSON representation
Provides mongoose support for storing RegExp
- Host: GitHub
- URL: https://github.com/mongoosejs/mongoose-regexp
- Owner: mongoosejs
- License: mit
- Created: 2013-02-22T21:54:23.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-10-08T15:24:45.000Z (about 10 years ago)
- Last Synced: 2024-09-28T23:52:44.733Z (3 months ago)
- Language: JavaScript
- Size: 122 KB
- Stars: 14
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
#mongoose-regexp
=================Provides [Mongoose](http://mongoosejs.com) support for storing `RegExp`.
[![Build Status](https://travis-ci.org/aheckmann/mongoose-regexp.png?branch=master)](http://travis-ci.org/aheckmann/mongoose-regexp)
Example:
```js
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 `RegExp`s 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 `RegExp`s stored and retrevied were generated in Node.js.[LICENSE](https://github.com/aheckmann/mongoose-regexp/blob/master/LICENSE)