# handler4mongodb

> 对mongodb模块进行常用操作的封装操作集.

Latest version **1.0.3** (published 2020-05-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install handler4mongodb
pnpm add handler4mongodb
yarn add handler4mongodb
bun add handler4mongodb
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-05-07 |
| First published | 2020-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | gambler |
| Maintainers | pretentious-gambler |
| Keywords | mongodb, proxy, javaScript, coffee-script |

## Links

- npm: https://www.npmjs.com/package/handler4mongodb
- Repository: https://github.com/so-hentai/handler4mongodb
- Homepage: https://github.com/so-hentai/handler4mongodb#readme
- Issues: https://github.com/so-hentai/handler4mongodb/issues
- npm.io page: https://npm.io/package/handler4mongodb

## Dependencies (4)

- [async](https://npm.io/package/async.md) ^3.1.0
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [mongodb](https://npm.io/package/mongodb.md) ^3.4.1
- [encaps-proxy](https://npm.io/package/encaps-proxy.md) ^1.1.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-05-07
- 1.0.2 — 2020-03-06
- 1.0.1 — 2020-03-06

## README

# 概述
本模块是针对mongoDB的CRUD操作进行封装的模块，你只需指定目标mongoDB的相关配置以及所操作的document，你将得到一个代理对象，为你提供mongoDB的相关操作，并支持日志记录.
# 开始
> npm install --save handler4mongodb
# 实例
```
const MongoDao = require("handler4mongodb");
const config = {
  "mongodb": {
		"username": "test", //用户名
		"password": "test", //密码
		"hostName": "127.0.0.1",  //数据库地址
		"port": "27017",  //端口
		"auth": "authSource=admin", //认证
		"DB_OPTS": {"useNewUrlParser": true, "useUnifiedTopology":true} //连接参数
	}
}
// 实例一个提供test库user表的操作代理对象
const dao = new MongoDao(config.mongodb, {test: ["user"]});
// 调用方式 对象.库名.表名.操作
dao.test.user.insert({name: "test"}, (err)=> {});
// 实例多个表操作代理对象
const dao = new MongoDao(config.mongodb, {test1: ["user1", "user2"], test2: ["user3"]});
// 调用方式 对象.库名.表名.操作
dao.test1.user1.insert({name: "test"}, (err)=> {});
dao.test1.user2.insert({name: "test"}, (err)=> {});
dao.test2.user3.insert({name: "test"}, (err)=> {});
...
```
# 优化
后续
# 更新日志
时间|版本|内容
--|--|--
2020/05/07|1.0.3|采用rollup压缩文件
2020/03/06|1.0.2|修复addOrUpdate操作缺少原子操作符$set，并更新测试样例；
2020/03/05|1.0.1|修复数据库会话提前关闭问题；CRUD改为批量操作；
2020/01/13|1.0.0|新增
# 免责声明
本工具仅用于学习交流使用，禁止用于商业用途，使用本工具所造成的的后果由使用者承担！ 有疑问请 mail to: xfqing_mid@163.com

---
_Source: https://npm.io/package/handler4mongodb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
