An operator for MongoDB in Node.js, providing a simple ORM-like interface for basic CRUD operations (insert, select, save, delete) with support for MongoDB operators like $and, $or, $gt, $lt, $regex, and more. Current stable version is 1.1.33. The package uses an event-driven change monitoring system and offers both ESM and UMD module formats. It is lightweight and minimal compared to full-featured ORMs like Mongoose, focusing on ease of use for small to medium projects. However, it lacks TypeScript support and comprehensive documentation, and the API uses callbacks/promises with minimal error handling.
npm install w-orm-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic CRUD operations: insert, select with operators, save (update), and delete.
Always handle the result as an array, even for single-document queries.
Set `autoInsert: true` to enable upsert behavior, or use `insert` for new documents.
Consider wrapping event listeners in promises or using async/await with the method results directly.
Always include all three required fields in the config object.
Use `import WOrm from 'w-orm-mongodb'` instead of the old UMD path.
Use `import WOrm from 'w-orm-mongodb'` (ESM) or `const WOrm = require('w-orm-mongodb')` (CJS).Store the instance: `const wo = WOrm(opt)`, then call `await wo.insert(...)`.
Ensure the URL format is correct: `mongodb://username:password@host:port` and the user has access to the specified database.
Create an instance first: `const wo = WOrm(opt)` then call `wo.on(...)`.