A simple MongoDB database handler for Node.js that wraps Mongoose to provide a convenient way to manage models and connect to MongoDB. Version 0.0.14 is the current stable release. It is designed for use with Discord.js, Express.js, and other applications. Ship with TypeScript types. Differentiator: provides automatic model loading from a directory and a template-based model definition approach. Alternative to using Mongoose directly with manual model setup.
npm install mongo-database-handlerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to initialize the handler, define a model using the Template class, and create a document.
Ensure the models directory exists and contains at least one .js or .ts file exporting a class that extends Template.
Use 'export default class MyModel extends Template' in model files.
Switch to ESM import syntax.
Ensure you import Template from 'mongo-database-handler' and extend it: class MyModel extends Template { ... }Pass a connectionURI option to the DatabaseHandler constructor: new DatabaseHandler({ connectionURI: 'your-mongo-uri' })