Metadata-Version: 2.4
Name: zcx
Version: 1.0.0
Summary: MongoDB 命令行管理工具
License: MIT License
        
        Copyright (c) 2023 Zcx
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: cli,mongodb,tool
Requires-Python: >=3.9
Requires-Dist: happy-python
Requires-Dist: pymongo>=4.0
Description-Content-Type: text/markdown

# mongodb-tool

mongodb操作工具

## 环境准备

```bash
pip install happy-python pymongo
```

## 使用举例

### 增加数据

```bash
python main.py -i '{"name": "John", "age": 30, "city": "New York"}'
```

### 增加数据
```bash
python main.py -i '{"name": "John", "age": 30, "city": "New York"}'
```

### 删除数据
```bash
python main.py -d '{"name": "John", "age": 30, "city": "New York"}'
```

### 查找数据
```bash
python main.py -s '{"name": "John"}'

python main.py -s 
```

### 修改数据
```bash
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格式）

```