Registry / database / mongodb-backup-4x

mongodb-backup-4x

JSON →
library3.2.1jsnpmunverified

Backup MongoDB databases to BSON or JSON files with optional tar packing and streaming. v3.2.1 supports Node >=4 and uses the native MongoDB driver. Key differentiators: supports parallel collection scan, metadata (indexes) saving, and query-based filtering. Alternatives: mongodump CLI, mongodb-backup-cli for command line.

npm install mongodb-backup-4x
INSTALL
IMPORT
SIG · MONGODB-BACKUP-4X
M
mongodb-backup-4x
databasejavascriptv3.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.

default
import backup from 'mongodb-backup'
const backup = require('mongodb-backup')
ESM import since v3. Use default import.
default
const backup = require('mongodb-backup')
CommonJS still works, but ESM is preferred.
backup
const { default: backup } = require('mongodb-backup')
const { backup } = require('mongodb-backup')
Named export 'backup' does not exist; use default.

Basic backup of a MongoDB database to BSON files in a local directory.

import backup from 'mongodb-backup'; backup({ uri: process.env.MONGO_URI ?? 'mongodb://localhost:27017/mydb', root: './backup', callback: (err) => { if (err) console.error('Backup failed:', err); else console.log('Backup complete'); } });
Debug
Known issues
deprecatedBson@0.4.11 has been pulled out, so versions >=1.3.0 and <=1.4.1 are deprecated
fix
Upgrade to v3.2.1 or later.
affects: >=1.3.0 <=1.4.1
breakingESM-only in v3; CommonJS require still works but default import changed.
fix
Use import backup from 'mongodb-backup' instead of require('mongodb-backup').
affects: >=3.0.0
gotchaOptions 'parser' defaults to 'bson'; for JSON output set parser: 'json'.
fix
Set parser: 'json' in options object.
affects: >=3.2.0
Errors
Common errors & fixes
Cannot find module 'mongodb-backup'
Package not installed or wrong import path
fix
Run 'npm install mongodb-backup' and ensure import/require uses correct case.
backup is not a function
Using wrong import style (e.g., destructuring named export)
fix
Use 'import backup from' or 'const backup = require(...).default'.
Error: connect ECONNREFUSED
MongoDB server not running or URI incorrect
fix
Start MongoDB or correct the URI in options.
TypeError: Cannot read property 'collection' of undefined
Invalid MongoDB URI or database name
fix
Verify URI includes database name and connection works.
Upgrade
Version history
3.2.1latest on npm
Audit
Dependencies
mongodbrequiredMongoDB native driver for database connection and operations
Agent activity
11 hits · last 30 days
node
10
Resources
mongodb-backup-4x — npm install mongodb-backup-4x · libregistry