MongoDB 命令行管理工具
Project description
mongodb-tool
mongodb操作工具
环境准备
pip install happy-python pymongo
使用举例
增加数据
python main.py -i '{"name": "John", "age": 30, "city": "New York"}'
增加数据
python main.py -i '{"name": "John", "age": 30, "city": "New York"}'
删除数据
python main.py -d '{"name": "John", "age": 30, "city": "New York"}'
查找数据
python main.py -s '{"name": "John"}'
python main.py -s
修改数据
python main.py -u '{"name": "John", "age": 34, "city": "Shanghai"}'
使用详细
请使用python main.py --help/-h
$ python main.py --help
2023-10-05 17:25:30 20519 [INFO] 未启用日志配置文件,加载默认设置
2023-10-05 17:25:30 20519 [INFO] 日志配置文件 '/home/colamps/.zcx/log.ini' 加载成功
2023-10-05 17:25:30 20519 [ERROR] 命令行参数错误,请查看使用说明:
usage: mongodb_tool [-c <config_file>] [-l <log_config_file>][-i <data>] [-d <data>] [-s <data>] [-u <data>] [--dump <filename>] [--import <filename>]
MongoDB工具
options:
-h, --help show this help message and exit
-c CONFIG_FILE 配置文件路径,默认为 ~/.zcx/config.ini
-l LOG_CONFIG_FILE 日志配置文件路径,默认为 ~/.zcx/log.ini
-i INSERT_DATA 执行插入操作,提供数据(JSON格式)
-d DELETE_DATA 执行删除操作,提供查询条件(JSON格式)
-s [SEARCH_DATA] 执行查询操作,提供查询条件(JSON格式)
-u UPDATE_DATA 执行更新操作,提供查询条件和更新数据(JSON格式)
--dump DUMP_FILE 导出数据到指定文件(JSON格式)
--import IMPORT_FILE 从指定文件导入数据(JSON格式)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zcx-1.0.0.tar.gz
(7.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
zcx-1.0.0-py3-none-any.whl
(9.7 kB
view details)
File details
Details for the file zcx-1.0.0.tar.gz.
File metadata
- Download URL: zcx-1.0.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b72888ce64d82fe418894f27e9bb45f2c014065b06fca4d9ba9959286bbf0594
|
|
| MD5 |
0e7ed1b571802e3fdd9a26543efdecb6
|
|
| BLAKE2b-256 |
75bb76d84b6c1f3444950220e5666ac088a6ad504a01193a438a346825ed8983
|
File details
Details for the file zcx-1.0.0-py3-none-any.whl.
File metadata
- Download URL: zcx-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
148acb4bfd35fba3f60561ae338ab51ae11f43229de069bc7ea7b1c6d41778ae
|
|
| MD5 |
43a987d1abb216479128cc4e2d9d1b47
|
|
| BLAKE2b-256 |
32d48c239ea4ce5c8e9712ac9b913986a22d788ed6515506f2338d6ec93998fb
|