feathers-nedb-puzzy-search
Add google-like $search
to NeDB service.find
queries.
Join and support our Community
Web and Mobile Developers PH
[ Facebook Page | Group ]
Install
npm install feathers-nedb-puzzy-search
Usage
const search = const messages = app // enable for message service, may use app.hooks toomessages let res = await servicelet res = await service
Besure to whitelist non-standard query parameters in your model.
That's ['$text', '$regex']
for MongoDB , and ['$where', '$regex']
for NeDB.
Options
feathers-nedb-puzzy-search
take two options in NeDB $where
mode:
fields
- Specify which fields to search.deep
- If true andfields
is undefined, will search deep in objects.
In NeDB $regex
mode it takes as service options the following:
excludeFields
- Specify which fields to exclude from search.fields
- Specify which fields to search. Mutually exclusive.
As query parameters it also takes $caseSensitive
Complete example
const feathers = const hooks = const NeDB = const service = const search = const Model = filename: './example.db' autoload: true const app = appappapp // you need node v7 or above for async / await syntax { let service = app await service let res = await service let res = await service console // [ { title: 'world around', _id: '1RDM5BJWX4DWr1Jg' }, // { title: 'hello world', _id: 'dX4bpdM1IsAFkAZd' } ] // { title: 'hello world', _id: 'dX4bpdM1IsAFkAZd' } ]}
Web and Mobile Developers PH
[ Facebook Page | Group ]
Join and support our Community License
ISC © 2019 Trinmar Boado MIT © 2019 Ray Foss MIT © 2017 Arve Seljebu