mongo-operator
A package for backup / cleanup / migrate mongodb.
Description:
A tool for backup / cleanup / migrate mongo.
This package can make you backup / cleanup / migrate more earlier with python3.
Initial testing data
- download
https://github.com/chienfeng0719/mongo-operator/tree/develop/mongo_init - run command
mongo-operator -r mongo_init
How To Use:
You can use mongo-operator through command line for backup/restore/drop database as the following example:
CLI
mongo-operator -b foo_bar -> backup foo_bar
mongo-operator -d foo_bar -> drop foo_bar
mongo-operator -r mongo_init -> restore data from mongo_init folder
You can also do some advanced operate with python:
Backup
from mongo_operator import BackupOperator
# init object
backup_operator = BackupOperator(hostname='localhost', port=27017, username='root', password='root')
# backup all database
backup_operator.backup(folder_path='./backup/')
# backup specific collection
backup_operator.backup(db_name='foo_bar', collection='foo_bar')
# backup specific collection with query
backup_operator.backup(db_name='foo_bar', collection='foo_bar', query_={'items': 'phone'})
# restore data from backup
backup_operator.restore(folder_path='./backup/', is_dropped=True)
Cleanup
from mongo_operator import CleanupOperator
# init object
cleanup_operator = CleanupOperator(hostname='localhost', port=27017, username='root', password='root')
# drop 'foo_bar' table in foo_bar
cleanup_operator.drop_collection(db_name='foo_bar', collection='foo_bar')
# drop foo_bar database
cleanup_operator.drop_db(db_name='foo_bar')
Migrate
from mongo_operator import MigrateOperator
# init object
migrate_operator = MigrateOperator(hostname='localhost',
port=27017,
username='root',
password='root',
target_hostname='192.168.1.1',
target_port=27017,
target_username='root',
target_password='root')
# import all database from target host
migrate_operator.import_database()
# import『foo_bar』database from target host
migrate_operator.import_database(db_name='foo_bar')
# export all database from to host
migrate_operator.export_database()
# export『foo_bar』database to target host
migrate_operator.export_database(db_name='foo_bar')
Buy me a coffee, if you like it!
Metadata
Release files for mongo-operator 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mongo-operator-0.0.4.tar.gz | 4.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mongo_operator-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / mongo-operator-0.0.4.tar.gz
| Download URL | mongo-operator-0.0.4.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78fcdc2c6e6b177770ab2b143f460896c08be92c510ab5fd673c22db2a4eea34
|
|
BLAKE2b-256 checksum How to use checksums |
549c99131945b87b2e3cee3a1e0a656ef268287b12a42a22eaadb37cc47bd966
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
|
Release files / mongo_operator-0.0.4-py3-none-any.whl
| Download URL | mongo_operator-0.0.4-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d0ab25748ea1229c4ac9031990f614dd12477b57e7326a1e5be38a5130ee769
|
|
BLAKE2b-256 checksum How to use checksums |
9f47c9ab4093b5e1bab1154faebd0cd38c8596f83fef121154287f9c7e487d39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
|
Security for mongo-operator 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.