Mongolass is an elegant MongoDB driver for Node.js that provides a Mongoose-like API with simpler schema definitions, a pure separation of Schema/Model/Entity, and an awesome plugin system. Current stable version is 4.4.7, with a release cadence of about 6-12 months. Key differentiators: optional pure schemas for validation only (not mixed with Model/Entity), powerful plugin hooks (before/after operations), and lightweight design (no heavy middleware overhead). It supports Node.js >=8, ESM and CJS, and is fully compatible with the native MongoDB driver (v3.x).
npm install mongolassNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Mongolass instance, defines a schema, inserts a document, and queries with sorting.
Use Mongolass.Types.ObjectId('yourIdString') when filtering or inserting by _id.Replace .exec() with .toArray() for find() or .next() for findOne().
Use insertOne/updateOne with schema validation; for raw aggregation, bypass schema or validate manually.
Check MongoDB driver docs for chainable methods like .limit(), .skip(), .project() instead of .select().
Always pass { dbName: 'yourdatabase' } in the options object to connect() or constructor.Use: const Mongolass = require('mongolass');Add { useUnifiedTopology: true } to connect options: new Mongolass('uri', { dbName: 'test', useUnifiedTopology: true })Reuse the model or schema reference, or use different schema names.
Ensure import/require is correct: const Mongolass = require('mongolass'); const ObjectId = Mongolass.Types.ObjectId;