A lightweight MongoDB client wrapper for Node.js that simplifies CRUD operations, aggregation, and transaction management. Current version is 1.4.0, with irregular release cadence. It provides a promise-based API with methods like find, insert, update, delete, aggregate, and transaction support. Unlike native MongoDB driver, it reduces boilerplate by accepting a parameter object for database, collection, limits, and field projection. It also includes a startTransaction helper that handles retries and commit/abort logic.
npm install veden-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to a MongoDB instance and performs a find operation with field selection, exclusion, sort, and limit.
Update transaction callbacks to return a promise with the desired result.
Ensure DB_HOSTS contains a single host:port; if using replica sets, specify the set in DB_REPLICA_SET.
Use db.count() to check if documents exist before fetching.
Use either fields (inclusive) or exclude_fields (exclusive), not both.
Access the _id via result._id instead of the direct return value.
Use const { MongoDatabase } = require('veden-mongodb');Run `npm install veden-mongodb` and ensure the package name is spelled correctly.
Ensure credentials are correct and add DB_AUTH_SOURCE if using a non-admin auth database.