Feathers.js hook that adds fuzzy search to MongoDB queries via $search, supporting both full-text search (MongoDB $text with stemming) and field-specific regex pattern matching. Version 2.0.1 is current. It applies as a before hook on find, update, patch, and remove. Key differentiators: simple API, automatic escaping for ReDoS prevention, and option to disable escaping for direct $text API access. Requires whitelisting of query operators in the service configuration.
npm install feathers-mongodb-fuzzy-searchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates installing, configuring, and using the hook for both full-text and regex fuzzy searches.
Update hooks to explicitly set escape: false if needed.
Add 'whitelist: ["$text", "$search", "$regex"]' to service configuration.
Create a text index via Model.createIndex() or MongoDB shell.
Add '$search' to the whitelist array in the service options, e.g., { whitelist: ['$text', '$search'] }.Ensure the service is properly set up with a Mongoose or MongoDB collection Model.
Call search() to get the hook function, e.g., app.hooks({ before: { all: [search()] } });