A customizable Mongoose plugin (v1.0.12) that transparently converts standard Mongoose find() queries into aggregation pipelines leveraging MongoDB Atlas Search indexes. Designed for Atlas deployments on MongoDB 4.2+, it can either overwrite Model.find() or add a separate .search() method. Requires manual Atlas Search index creation. Stable release; low update cadence.
npm install mongoose-atlas-searchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Load the plugin, initialize it on a Mongoose model with a custom search function, then call find() with a searchKey to trigger Atlas Search aggregation.
Create an Atlas Search index in the Atlas UI or via the Atlas API on the target collection with appropriate mappings.
Ensure your connection targets an Atlas cluster with Search enabled. Use non-Atlas deployments of Mongoose without this plugin.
Read the documentation: set overwriteFind: false and use Model.search() explicitly when needed.
Use require() instead of import. If using ES modules, consider using dynamic import or switching packages.
Ensure the returned object has a valid Atlas Search operator (e.g., { wildcard: { ... } }) and that path fields exist in the Atlas Search index.Use const atlasPlugin = require('mongoose-atlas-search'); instead of import.Connect to an Atlas cluster with Atlas Search enabled on MongoDB 4.2+.
Call atlasPlugin.initialize({ model: YourModel, ... }) with a valid Mongoose model.Create a Search index via Atlas UI with the correct name (default is 'default') or match the index name used in searchFunction.