🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

mongoose-fuzzy-search-next

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-fuzzy-search-next

This is a simple fuzzy search for mongodb with the help of this package you can easily search mongodb document by single or multiple Key

latest
npmnpm
Version
1.0.13
Version published
Maintainers
1
Created
Source

mongoose-fuzzy-search-next

This is a simple fuzzy search for mongodb with the help of this package you can easily search mongodb document by single or multiple Key

Any query

contact me on Linkedin kundan kumar .

Installation

Use the package manager mongoose-fuzzy-search-next to install.

npm i mongoose-fuzzy-search-next

Your Collection

Product collection
Object key Pname, Description 
{
    "_id" : ObjectId("6017a848a506280648cac2b3"),
    "Pname" : "Laptop",
    "Description" : "Lenovo i7 MD Sliver"
}

Example-1 with mongoose



const {FuzzySearch}=require('mongoose-fuzzy-search-next');
const data=await PRODUCT_TABLE.find(FuzzySearch(['Pname','Description'],'my search keyword'));


Example-2 with Condition



const {FuzzySearch}=require('mongoose-fuzzy-search-next');
const data=await PRODUCT_TABLE.find({$and:[FuzzySearch(['Pname','Description'],'laptop'),{Price:{$gt:12500}}]});



Example-3 with search number 452015



const {FuzzySearch}=require('mongoose-fuzzy-search-next');
const data=await PRODUCT_TABLE.find(FuzzySearch(['PinCode','Description'],'452015'));



Example-4 with aggregation



const {FuzzySearch}=require('mongoose-fuzzy-search-next');
 const data=await PRODUCT_TABLE.aggregate([
   {$match:{$and:[
   FuzzySearch(['Pname'],'oil'),
   {Price:{$gt:0}}]
  }}
]);



Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Keywords

mongoose

FAQs

Package last updated on 30 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts