Registry / database / mongodb-backup-fixed

mongodb-backup-fixed

JSON →
library1.7.2jsnpmunverified

A fixed fork of mongodb-backup for MongoDB backup operations. Version 1.7.2 patches a breaking change where MongoDB deprecated the snapshot() method, replacing it with $snapshot query operator. Provides programmatic backup of MongoDB databases to disk or tar streams, supporting BSON or JSON output, collection filtering, query limiting, and parallel collection scanning. The original package is no longer maintained by its author, hex7c0, leading to this community fix. Release cadence is sporadic, with no recent updates beyond the snapshot fix. Key differentiator: it directly addresses the snapshot deprecation without requiring external mongodump.

npm install mongodb-backup-fixed
INSTALL
IMPORT
SIG · MONGODB-BACKUP-FIX
M
mongodb-backup-fixed
databasejavascriptv1.7.2
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.

backup
var backup = require('mongodb-backup');
import backup from 'mongodb-backup';
CommonJS require; no ESM or default export available.
backup (CommonJS with destructuring)
var backup = require('mongodb-backup');
const { backup } = require('mongodb-backup');
The package exports a single function; destructuring will result in undefined.
backup (ESM attempt)
const backup = require('mongodb-backup');
import * as backup from 'mongodb-backup';
Package does not support ES modules; use require().

Shows how to perform a MongoDB backup using JSON format, specifying collections and a callback.

var backup = require('mongodb-backup'); backup({ uri: process.env.MONGO_URI || 'mongodb://localhost:27017/mydb', root: './backup', parser: 'json', collections: ['users', 'posts'], callback: function(err) { if (err) { console.error('Backup failed:', err); } else { console.log('Backup completed successfully'); } } });
Debug
Known issues
breakingMongoDB deprecated snapshot() method; this package fixes it by using $snapshot query operator.
fix
Use mongodb-backup-fixed instead of the original mongodb-backup for MongoDB >=3.2.
affects: >=1.7.0
deprecatedThe original mongodb-backup package is unmaintained; use mongodb-backup-fixed for fixes.
fix
Switch to mongodb-backup-fixed (npm install mongodb-backup-fixed).
affects: >=1.0.0
gotchaBson@0.4.11 was pulled from npm; versions 1.3.0 to 1.4.1 are deprecated.
fix
Update to mongodb-backup-fixed >=1.7.0 or use a different bson version.
affects: >=1.3.0 <1.4.2
gotchaThe package only exports a single function; destructuring will yield undefined.
fix
Use var backup = require('mongodb-backup'); not const { backup } = require(...);
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: collection.find(...).snapshot is not a function
MongoDB driver removed snapshot() method; original mongodb-backup uses it.
fix
Use mongodb-backup-fixed which uses $snapshot query syntax.
Cannot find module 'mongodb-backup'
The original package may not be installed; user intended to use the fixed version.
fix
Run npm install mongodb-backup-fixed and require('mongodb-backup-fixed').
Upgrade
Version history
1.7.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
mongodb-backup-fixed — npm install mongodb-backup-fixed · libregistry