https://github.com/mikeibberson/mongoose-partial-search
Regex-powered partial search plugin
https://github.com/mikeibberson/mongoose-partial-search
mongoose mongoose-plugin
Last synced: 5 months ago
JSON representation
Regex-powered partial search plugin
- Host: GitHub
- URL: https://github.com/mikeibberson/mongoose-partial-search
- Owner: MikeIbberson
- License: mit
- Created: 2019-11-27T21:17:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T00:49:57.000Z (over 3 years ago)
- Last Synced: 2025-04-04T17:15:22.466Z (over 1 year ago)
- Topics: mongoose, mongoose-plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/mongoose-partial-search
- Size: 1.4 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🔎 Mongoose partial search plugin
This packages adds a searchBuilder static method to the Mongoose model that returns a case-insensitive, regex-powered query to drop into your find functions.
``` Javascript
const plugin = require('mongoose-partial-search');
const mongoose = require('mongoose');
const Schema = new mongoose.Schema({
name: {
type: String,
searchable: true,
}
});
Schema.plugin(plugin);
const Model = mongoose.model('foo', Schema);
const query = Model.searchBuilder('bar');
// then, use the query however you like.
```