mongodb-search-interface v1.2.5 is a lightweight TypeScript utility that builds MongoDB query objects from structured search parameters, commonly used in GraphQL resolvers or REST APIs. It provides a simple function to transform a filter object into a MongoDB query with support for operators like $text, $regex, and comparison operators. Unlike more manual approaches, it offers a declarative way to construct search queries without raw MongoDB query building, ideal for search endpoints. The package is stable but infrequently updated, last release in 2021. It ships TypeScript definitions.
npm install mongodb-search-interfaceNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates searchInterface basic usage: transforming a filter object into a MongoDB query with $regex for text search.
Use { $text: { $search: '...' } } manually if you need MongoDB $text indexes.Consider building queries manually or use a more active library like 'mongo-query-builder'.
import { searchInterface } from 'mongodb-search-interface'Use named import: import { searchInterface } from 'mongodb-search-interface'No dependency data recorded yet.