Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mikeibberson/mongoose-partial-search

Regex-powered partial search plugin
https://github.com/mikeibberson/mongoose-partial-search

mongoose mongoose-plugin

Last synced: about 1 month ago
JSON representation

Regex-powered partial search plugin

Awesome Lists containing this project

README

        

🔎 Mongoose partial search plugin


Status
Coverage Status

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.
```