Tarikul Islam Logo

TARIKUL

HomeAboutSkillsServicesExperiencePortfolioBlogContact
TARIKUL.DEV

© 2021 - 2026 TARIKUL ISLAM. All rights reserved.

  1. Home
  2. Blog
  3. MongoDB Backup & Restore Utility – A Developer-Friendly Way to Protect Your Data
Back to Blog
Database

MongoDB Backup & Restore Utility – A Developer-Friendly Way to Protect Your Data

TARIKUL ISLAM

TARIKUL ISLAM

December 6, 20253 min read152 views
MongoDB Backup & Restore Utility – A Developer-Friendly Way to Protect Your Data

Backing up a MongoDB database shouldn’t require memorizing long commands or fighting with complex scripts. To solve this, I built an open-source MongoDB Backup & Restore Utility — a simple yet powerful Node.js tool that helps developers back up or restore clusters, databases, or individual collections using a clean, interactive UI.

Whether you're preparing for deployment, migrating data, or simply ensuring safe data storage, this tool makes the entire process quick, organized, and beginner-friendly.

🔧 What This Tool Does

This utility gives you an all-in-one solution to manage your MongoDB data with ease. Key capabilities include:

✔️ Three Backup Scopes

  1. Full Cluster Backup
  2. Single Database Backup
  3. Single Collection Backup

✔️ Interactive User Interface

Instead of manually typing database or collection names, the script lets you select them from clean interactive menus.

✔️ Timestamped Backup Folders

Every backup is stored inside:

exports/<username>@<cluster>_<YYYY-MM-DD_HH-MM-SS>/

This keeps your backups organized and instantly identifiable.

✔️ Safe Restore System

When restoring data, you can:

  1. Overwrite existing collections, or
  2. Append data safely without deleting anything.

✔️ Readable JSON Format

All collections are exported as human-friendly JSON files, making them ideal for debugging, analysis, or documentation.

🚀 Why I Created This Tool

During development, I often needed a quick way to:

  1. Export collections before testing risky changes
  2. Share sample datasets with teammates
  3. Restore data after experiments
  4. Move databases between clusters

Existing tools were either too heavy (like full BSON dumps) or required a lot of manual typing.

So I built a clean and simple CLI-driven system that anyone can run with a single command:

node index.js

⚙️ Setup Requirements

You’ll need:

  1. Node.js 18 or higher
  2. pnpm (recommended), npm, or yarn
  3. A MongoDB connection URI

After cloning the repository and installing dependencies, create a .env file:

MONGODB_URI="mongodb+srv://<username>:<password>@<cluster>"

That’s it — you’re ready to back up or restore data instantly.

🧭 How It Works (Step-by-Step)

After running the script, the system will guide you through:

  1. Choose Action – Backup or Restore
  2. Choose Scope – Cluster, Database, or Collection
  3. Select Target – Pick from an auto-loaded list
  4. Restore Options – Choose overwrite or append
  5. Done – Your data is exported/imported cleanly

Backup folders look like this:

exports/
└── dev@cluster0-mongodb-net_2025-12-06_13-12-41/
└── my_database/
├── users.json
└── products.json

Everything is timestamped and auto-organized.

📌 Important Notes

  1. Only JSON data is exported — indexes and BSON types (like ObjectId with metadata) are not preserved.
  2. If you need full BSON-level replication, use:
  3. mongodump
  4. mongorestore

This tool is perfect for lightweight development backups, quick migrations, and debugging.

📂 Repository & Contact

🔗 GitHub Repo: https://github.com/faketi101/mongo-db-backup

👨‍💻 Author: TARIKUL ISLAM

🌐 Website: https://tarikul.dev/

📧 Email: hello@tarikul.dev

If you have ideas or want new features added, feel free to open an issue or contribute!

This utility is built with simplicity, developer productivity, and real-world workflows in mind. If you work with MongoDB regularly, this tool may quickly become a go-to part of your toolbox.

Happy coding! 🚀

TARIKUL ISLAM

About TARIKUL ISLAM

Programmer and Developer

Share this article:

Next →

A Complete Guide to Uploading & Syncing Your Project Files via FTP

Recent Posts

A Complete Guide to Uploading & Syncing Your Project Files via FTP

A Complete Guide to Uploading & Syncing Your Project Files via FTP

Dec 6