Opinionated Express middleware that auto-generates CRUD endpoints (find, findById, create, update, delete, count, aggregate) from Mongoose schemas. Stable v3.0.3, actively maintained, ships TypeScript types. Key differentiator: minimal configuration for rapid REST API prototyping with built-in support for default filters, bulk operations, and multi-status responses for array inputs. Requires peer dependency mongoose ^8.20.0.
npm install mongoose-express-middlewareNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes MongooseExpressMiddleware with a custom schema and options, then attaches CRUD middleware to an Express app.
Upgrade mongoose to 8.20.0 or later.
Rename method calls: index -> find, show -> findById, bulkShow -> findMany, bulkUpdate -> updateMany, bulkDestroy -> deleteMany, destroy -> deleteById.
Place `app.get('/', crud.find)` BEFORE `app.get('/:id', crud.findById)`.Ensure defaultFilter uses valid MongoDB query syntax; test with findById using an ID that matches the filter.
Use `import MongooseExpressMiddleware from 'mongoose-express-middleware'` or `const MongooseExpressMiddleware = require('mongoose-express-middleware')`.Use `const MongooseExpressMiddleware = require('mongoose-express-middleware');` directly.Ensure the same model name is used and the schema is valid. Register model if needed: `Mongoose.model(modelName, schema)`.
Verify `crud` is an instance of MongooseExpressMiddleware: `new MongooseExpressMiddleware(...)`.
Use `app.get('/', crud.find)` not `app.get('/', crud)`.Call `Mongoose.connect('mongodb://localhost:27017/test')` before handling requests.