Registry / database / mongodb-io

mongodb-io

JSON →
library0.2.5jsnpmunverified

A Node.js library for exporting and importing MongoDB documents using mongodump and mongorestore. Version 0.2.5, last updated 2018. Only supports Linux x64 and macOS x64. Provides a programmatic API to backup/restore databases or collections, with options for filtering collections via queries and dropping before restore. Limited to local MongoDB instances; no cloud or authentication beyond user/password.

npm install mongodb-io
INSTALL
IMPORT
SIG · MONGODB-IO
M
mongodb-io
databasejavascriptv0.2.5
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.

DBIO
import DBIO from 'mongodb-io'
const DBIO = require('mongodb-io')
The package is ESM-only as of published version; does not export a CommonJS module.

Exports a single MongoDB database to a tar.gz file using default config.

import DBIO from 'mongodb-io'; const config = { host: '127.0.0.1', port: 27017, user: process.env.MONGO_USER ?? '', password: process.env.MONGO_PASS ?? '', out: 'backup', drop: false }; (async () => { try { const filePath = await DBIO.export({ config, dbs: ['myDatabase'] }); console.log('Backup created at:', filePath); } catch (err) { console.error(err); } })();
Debug
Known issues
deprecatedPackage has not been updated since 2018; may not work with newer MongoDB versions.
fix
Consider using mongodump/mongorestore directly or a maintained alternative.
affects: >=0.0.0
gotchaRequires mongodump and mongorestore binaries installed on the system.
fix
Ensure MongoDB Database Tools are installed and in PATH.
affects: >=0.0.0
gotchaOnly supports Linux x64 and macOS x64; Windows users cannot use this package.
fix
Use a different migration tool or run in a Docker container.
affects: >=0.0.0
Errors
Common errors & fixes
Error: {name: 'DBIO_XXX_ERR', message: 'where error happend'}
The package does not provide detailed error messages; this is a placeholder example from the README.
fix
Check the console output from mongodump/mongorestore for actual error details.
SyntaxError: Cannot use import statement outside a module
Using ES modules (import) in a CommonJS (require) environment.
fix
Add "type": "module" to package.json or use dynamic import().
Upgrade
Version history
0.2.5latest on npm
Audit
Dependencies
mongodumprequiredbinary required for export
mongorestorerequiredbinary required for import
Agent activity
6 hits · last 30 days
node
6
Resources
mongodb-io — npm install mongodb-io · libregistry