Registry / database / mongodb-cg-lib

mongodb-cg-lib

JSON →
library1.3.3jsnpmunverified

A Node.js library wrapping the official MongoDB driver to provide simplified CRUD operations (find, insert, update, delete) designed for use with N3xGen components and OIH (Open Integration Hub) flows. Version 1.3.3 uses the MongoDB Node.js driver (v3.x) and the util-nxg-cg library for logging and validation. It only supports callback-based usage and lacks native Promise or async/await support. The library is not actively maintained; last updated in 2022, with limited documentation and no TypeScript definitions.

npm install mongodb-cg-lib
INSTALL
IMPORT
SIG · MONGODB-CG-LIB
M
mongodb-cg-lib
databasejavascriptv1.3.3
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.

mongoProcess
import { mongoProcess } from 'mongodb-cg-lib'
const mongoProcess = require('mongodb-cg-lib')
Library provides only a named export; default import is not supported. Use ESM or CJS named import.
default
import { mongoProcess } from 'mongodb-cg-lib'
import mongoProcess from 'mongodb-cg-lib'
No default export exists; only named export mongoProcess is available.
MongoClient
import { MongoClient } from 'mongodb'
import { MongoClient } from 'mongodb-cg-lib'
MongoClient is not re-exported by mongodb-cg-lib; must be imported directly from the mongodb package.

Demonstrates using mongoProcess with callback to perform a find operation.

const { mongoProcess } = require('mongodb-cg-lib'); const config = { uri: process.env.MONGO_URI ?? 'mongodb://localhost:27017', dbName: 'test', collection: 'users', operation: 'find', query: { name: 'Alice' }, options: {} }; mongoProcess(config, (err, result) => { if (err) { console.error('Error:', err); } else { console.log('Result:', result); } });
Debug
Known issues
deprecatedLibrary is not actively maintained; no updates since 2022. Use official MongoDB driver directly.
fix
Replace with 'mongodb' driver and use native async/await.
affects: >=1.0.0
gotchamongoProcess expects a callback; does not return a Promise. Using await will not work.
fix
Wrap in a Promise: await new Promise((resolve, reject) => mongoProcess(config, (err, res) => err ? reject(err) : resolve(res))).
affects: >=1.0.0
gotchaThe 'options' parameter in config is unused in some operations; behavior may be unpredictable.
fix
Set options to empty object if not needed, and test each operation thoroughly.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: mongoProcess is not a function
Using default import instead of named import.
fix
Change to: const { mongoProcess } = require('mongodb-cg-lib'); or import { mongoProcess } from 'mongodb-cg-lib';
Cannot read property 'find' of undefined
Missing or malformed config object; db or collection is undefined.
fix
Ensure config contains 'uri', 'dbName', 'collection', 'operation', and 'query' where needed.
Upgrade
Version history
1.3.3latest on npm
Audit
Dependencies
mongodbrequiredCore dependency for database connection and operations
util-nxg-cgrequiredUtility for logging and data validation
Agent activity
4 hits · last 30 days
node
4
Resources
mongodb-cg-lib — npm install mongodb-cg-lib · libregistry