mongoose-partial-search

1.0.6 • Public • Published

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

  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.

Readme

Keywords

none

Package Sidebar

Install

npm i mongoose-partial-search

Weekly Downloads

3

Version

1.0.6

License

MIT

Unpacked Size

9.14 kB

Total Files

14

Last publish

Collaborators

  • 3merge