# @phenyl/mongodb

> MongoDB client.

Latest version **4.2.0** (published 2025-01-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @phenyl/mongodb
pnpm add @phenyl/mongodb
yarn add @phenyl/mongodb
bun add @phenyl/mongodb
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2025-01-23 |
| First published | 2019-04-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 44 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 58 |
| Author | Shin Suzuki |
| Maintainers | shinout, naturalclar, sasurau4, wh1tecat, bowzstandard, alternacrow, camcam-lemon, 1natsu, tainakanchu |

## Links

- npm: https://www.npmjs.com/package/@phenyl/mongodb
- Repository: https://github.com/phenyl-js/phenyl
- Homepage: https://github.com/phenyl-js/phenyl#readme
- Issues: https://github.com/phenyl-js/phenyl/issues
- npm.io page: https://npm.io/package/@phenyl/mongodb

## Dependencies (6)

- [sp2](https://npm.io/package/sp2.md) ^1.6.3
- [bson](https://npm.io/package/bson.md) ^4.4.0
- [mongodb](https://npm.io/package/mongodb.md) ^4.0.0
- [@phenyl/utils](https://npm.io/package/@phenyl/utils.md) ^4.1.0
- [@phenyl/interfaces](https://npm.io/package/@phenyl/interfaces.md) ^4.1.0
- [@phenyl/central-state](https://npm.io/package/@phenyl/central-state.md) ^4.2.0

## Recent versions

- 4.2.0 (latest) — 2025-01-23
- 4.1.0 — 2022-03-16
- 4.0.3 — 2021-02-16
- 4.0.2 — 2021-02-09
- 4.0.1 — 2020-10-24
- 4.0.0 — 2020-10-02
- 3.0.0 — 2020-06-18
- 2.1.0 — 2020-04-01
- 2.0.2 — 2020-03-25
- 2.0.1 — 2020-03-13
- 1.2.0 — 2019-12-26
- 2.0.0 — 2019-12-26
- 1.1.1 — 2019-08-29
- 1.1.0 — 2019-08-29
- 1.0.6 — 2019-08-28
- … 18 more at https://npm.io/package/@phenyl/mongodb/versions

## README

# @phenyl/mongodb

MongoDB client.

## usage
See [here](../rest-api/README.md) if you use phenylMongoDbClient on your server.

```js
import { PhenylMongoDbClient, connect } from "@phenyl/mongodb"

const connection = await connect({
  url: "mongodb://localhost:27017",
  dbname: "mydb",
});

const phenylMongoDbClient = new PhenylMongoDbClient(connection)

await phenylMongoDbClient.insertAndGet({ entityName: "user", value: { id: "user" } })
const { entity: user } = phenylMongoDbClient.get({ entityName: "user", id: "user" })
```

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