mongoose-partial-search

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
mongoose-partial-search
1.0.62 years ago3 years agoMinified + gzip package size for mongoose-partial-search in KB

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.


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.