Registry / database / exframe-db

exframe-db

JSON →
library4.0.6jsnpmunverified

A wrapper around Mongoose for MongoDB connection management within the Harmony Framework. Exframe-db provides Mongoose connection initialization and graceful shutdown integration with exframe-service. Version 4.0.6 requires Node >=18.0.0 and peer dependencies exframe-health 1.x, exframe-logger 3.x, and exframe-service 1.x. It ships TypeScript types. The package is tightly coupled to the Harmony Framework ecosystem and is not intended for standalone use. Compared to mongoose directly, it adds logging and lifecycle hooks.

npm install exframe-db
INSTALL
IMPORT
SIG · EXFRAME-DB
E
exframe-db
databasejavascriptv4.0.6
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.

default
✓ const db = require('exframe-db')
✗ import db from 'exframe-db'
Package uses CommonJS; ESM import may cause issues unless using a bundler that handles CJS interop.
init
✓ db.init({ logger, dbUrl })
✗ init({ logger, dbUrl })
init is a method of the default export, not a named export.
default (TypeScript)
✓ import db from 'exframe-db'
✗ const db = require('exframe-db')
When using TypeScript with ESM mode, use default import. For CommonJS Node, use require.

Initializes MongoDB connection with exframe-db using environment variables for logger token and database URL.

const db = require('exframe-db'); const logger = require('exframe-logger').create(process.env.LOGSENE_TOKEN || 'token'); db.init({ logger, dbUrl: process.env.MONGO_URL || 'mongodb://localhost:27017/harmony' }); console.log('Database initialized');
Debug
Known issues
breakingPeer dependencies must be installed manually; npm does not install them automatically in some versions.
fix
Run npm install exframe-health@1.x exframe-logger@3.x exframe-service@1.x
affects: >=4.0.0
gotchainit() requires both logger and dbUrl; missing logger will cause undefined errors.
fix
Ensure logger is created via require('exframe-logger').create(...)
affects: >=4.0.0
gotchaPackage is CommonJS only; ESM imports may fail without proper handling.
fix
Use require() or configure your bundler to handle CJS interop.
affects: >=4.0.0
breakingRequires Node >=18.0.0; downgrading Node may cause syntax errors.
fix
Update Node to version 18 or later.
affects: >=4.0.0
Errors
Common errors & fixes
Cannot find module 'exframe-db'
Package not installed or missing from node_modules.
fix
Run npm install exframe-db
TypeError: db.init is not a function
Wrong import style; using named import instead of default.
fix
Use const db = require('exframe-db') then db.init(...)
Error: Cannot find module 'exframe-logger'
Peer dependency exframe-logger not installed.
fix
Run npm install exframe-logger@3.x
Upgrade
Version history
4.0.6latest on npm
Audit
Dependencies
exframe-healthrequiredRequired peer dependency for health checks
exframe-loggerrequiredRequired peer dependency for logging
exframe-servicerequiredRequired peer dependency for graceful shutdown
Agent activity
4 hits · last 30 days
node
4
Resources
exframe-db — npm install exframe-db · libregistry