This Python script facilitates the seamless transfer of data between MongoDB databases. It connects to a source MongoDB database, retrieves user information, and transfers it to a specified destination database. The script ensures efficient and secure migration of data, making it a valuable tool for managing MongoDB databases in various applications.
- Flexible Configuration: Easily customize source and destination MongoDB connection details.
- User Data Transfer: Transfer user information, ensuring data consistency between databases.
- Error Handling: Robust error handling to manage exceptions during the data transfer process.
-
Clone the repository:
git clone https://github.com/JayArmo/mongo-data-transfer-python
-
Install dependencies:
pip install -r requirements.txt
- Configure MongoDB URLs in
main.py
.SOURCE_DB_URL = "" DESTINATION_DB_URL = "" source_client = MongoClient(SOURCE_DB_URL) source_db = source_client['My_DB'] source_collection = source_db['users'] destination_client = MongoClient(DESTINATION_DB_URL) destination_db = destination_client['My_DB'] destination_collection = destination_db['users']
- Run the script:
python main.py
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please fork the repository and submit a pull request.
- pymongo: MongoDB driver for Python.
For any questions or issues, please open an issue.