Registry / database / mongodb-restore-streaming

mongodb-restore-streaming

JSON →
library1.6.4jsnpmunverified

A streaming MongoDB restore utility for importing data from mongodb-backup or similar dump formats. Current stable version is 1.6.4, released with no active development cadence. It is a fork of hex7c0's mongodb-restore, providing a Node.js API to restore MongoDB collections from a backup directory. Key differentiators: streaming restore (avoids loading entire dataset into memory), supports standard mongodump output format, and targets Node.js >=4. However, the project appears to be in maintenance mode with limited updates.

npm install mongodb-restore-streaming
INSTALL
IMPORT
SIG · MONGODB-RESTORE-ST
M
mongodb-restore-streaming
databasejavascriptv1.6.4
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.

restore
import restore from 'mongodb-restore-streaming'
const restore = require('mongodb-restore-streaming').default
Default export is the restore function. In CommonJS, use `const restore = require('mongodb-restore-streaming')`.

Shows how to use the default restore function to restore a MongoDB backup from a directory.

import restore from 'mongodb-restore-streaming'; import { MongoClient } from 'mongodb'; const uri = process.env.MONGO_URI ?? 'mongodb://localhost:27017'; const dbName = 'myDatabase'; const backupDir = './backup'; async function run() { const client = new MongoClient(uri); await client.connect(); const db = client.db(dbName); restore({ db, path: backupDir, }, (err, result) => { if (err) { console.error('Restore failed:', err); } else { console.log('Restore completed:', result); } client.close(); }); } run().catch(console.error);
Debug
Known issues
gotchaThe `db` parameter must be a connected MongoClient Db instance, not a connection string or URI.
fix
Pass `client.db(dbName)` after connecting.
affects: >=1.0.0
gotchaThe backup directory expected to be in mongodump format (BSON files and metadata). Other formats may not work.
fix
Ensure backup is created with mongodump or compatible tool.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: restore is not a function
Incorrect import or require statement (e.g., using named import instead of default).
fix
Use `const restore = require('mongodb-restore-streaming')` or `import restore from 'mongodb-restore-streaming'`.
Upgrade
Version history
1.6.4latest on npm
Audit
Dependencies
asyncrequiredUsed for control flow of streaming operations
mongodbrequiredOfficial MongoDB driver for database operations
Agent activity
6 hits · last 30 days
node
4
Amazon
1
Resources
mongodb-restore-streaming — npm install mongodb-restore-streaming · libregistry