Skip to content

A Python Script that allows you to migrate Data from your MongoDB live database to your local MongoDB database.

Notifications You must be signed in to change notification settings

ennanuel/mongo-migrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

mongo-migrate

MongoDB Data Migration Script

This script allows you to migrate data from a live MongoDB database to a local MongoDB database.

Prerequisites

  • Python 3.x installed
  • Pip package manager installed

Installation

  1. Clone this repository:

    git clone https://github.com/ennanuel/mongo-migrate.git
  2. Navigate to the project directory:

    cd your-repo
  3. Install the required packages:

    pip install -r requirements.txt

Usage

1. Set up Environment Variables

Create a .env file in the project directory with the following content:

LIVE_MONGO_URI=your_live_mongo_uri
LOCAL_MONGO_URI=your_local_mongo_uri

Replace your_live_mongo_uri and your_local_mongo_uri with your actual MongoDB connection URIs.

2. Run the Script

Run the migration script using the following command:

python mongo_migration.py

Replace placeholders with your actual MongoDB connection URIs and database name.

Note

  • The script will clear existing data in the local database for each collection before migrating data.
  • Make sure to have backups of your data before running the migration.

About

A Python Script that allows you to migrate Data from your MongoDB live database to your local MongoDB database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages