Registry / database / extended-mongodb-client

extended-mongodb-client

JSON →
library1.2.1jsnpmunverified

Extended MongoDB Client (v1.2.1) is a thin wrapper around the official MongoDB Node.js driver, adding convenience methods and default configurations. It provides a simplified interface for common operations like connection management, CRUD, and aggregation, with built-in retry logic and connection pooling. Notable features include automatic reconnection, typed schemas, and plugin support. Designed for Node.js applications using MongoDB as a primary database, it abstracts boilerplate code while retaining access to the full driver API. Release cadence is irregular; currently stable. Differentiators: lightweight with minimal overhead compared to larger ORMs like Mongoose, and TypeScript-first with comprehensive type definitions.

npm install extended-mongodb-client
INSTALL
IMPORT
SIG · EXTENDED-MONGODB-C
E
extended-mongodb-client
databasejavascriptv1.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ExtendedMongoClient
✓ import ExtendedMongoClient from 'extended-mongodb-client'
✗ const { ExtendedMongoClient } = require('extended-mongodb-client')
Default CJS export; named import fails in CommonJS
connect
✓ import { connect } from 'extended-mongodb-client'
✗ import connect from 'extended-mongodb-client'
Named export; must use destructuring even in ESM
MongoClientConfig
✓ import type { MongoClientConfig } from 'extended-mongodb-client'
✗ import { MongoClientConfig } from 'extended-mongodb-client'
TypeScript interface; use `import type` for runtime-free imports

Demonstrates connection, insertion, and query using the ExtendedMongoClient wrapper.

import ExtendedMongoClient from 'extended-mongodb-client'; const uri = process.env.MONGODB_URI ?? 'mongodb://localhost:27017'; const dbName = process.env.DB_NAME ?? 'test'; async function main() { const client = new ExtendedMongoClient(uri); await client.connect(); const db = client.db(dbName); const collection = db.collection('items'); await collection.insertOne({ name: 'example', value: 1 }); const result = await collection.findOne({ name: 'example' }); console.log(result); await client.close(); } main().catch(console.error);
Debug
Known issues
breakingv1.2.0 changed the default port from 27018 to 27017
fix
Update connection string if relying on default port change.
affects: <1.2.0
deprecatedThe `createIndex` method is deprecated; use `createIndexes` instead
fix
Replace `createIndex` with `createIndexes`.
affects: >=1.0.0
gotchaConnection timeout default is 10 seconds; may cause issues on slow networks
fix
Set `connectTimeoutMS` in options to increase timeout.
affects: >=1.0.0
breakingv1.1.0 removed support for callbacks; use async/await only
fix
Refactor callback-based code to async/await.
affects: <1.1.0
deprecatedThe `update` method is deprecated; use `updateOne` or `updateMany`
fix
Replace `update` with `updateOne` or `updateMany`.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: ExtendedMongoClient is not a constructor
Incorrect import; used named import instead of default
fix
Use `import ExtendedMongoClient from 'extended-mongodb-client'`
MongoError: Authentication failed.
Missing credentials or wrong database name in URI
fix
Check that URI includes username:password@host/authDb if authentication is enabled.
MongoNetworkError: failed to connect to server [localhost:27017] on first connect
MongoDB server not running or wrong host/port
fix
Ensure mongod is running and accessible at the specified host and port.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies
mongodbrequiredcore MongoDB driver for database operations
Agent activity
11 hits · last 30 days
node
10
Resources