# nuxt-mongodb

> A simple way to use mongoDB in your Nuxt 3 project.

Latest version **1.0.13** (published 2023-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install nuxt-mongodb
pnpm add nuxt-mongodb
yarn add nuxt-mongodb
bun add nuxt-mongodb
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.13 |
| Published | 2023-08-07 |
| First published | 2023-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 24 |
| Maintainers | tim103 |

## Links

- npm: https://www.npmjs.com/package/nuxt-mongodb
- Repository: https://github.com/timb-103/nuxt-mongodb
- Homepage: https://github.com/timb-103/nuxt-mongodb#readme
- Issues: https://github.com/timb-103/nuxt-mongodb/issues
- npm.io page: https://npm.io/package/nuxt-mongodb

## Dependencies (4)

- [defu](https://npm.io/package/defu.md) 6.1.2
- [mongodb](https://npm.io/package/mongodb.md) 5.7.0
- [@nuxt/kit](https://npm.io/package/@nuxt/kit.md) 3.6.5
- [console-log-colors](https://npm.io/package/console-log-colors.md) 0.4.0

## Recent versions

- 1.0.13 (latest) — 2023-08-07
- 1.0.12 — 2023-08-07
- 1.0.11 — 2023-08-06
- 1.0.10 — 2023-08-04
- 1.0.9 — 2023-08-04
- 1.0.8 — 2023-08-04
- 1.0.6 — 2023-08-02
- 1.0.5 — 2023-07-28
- 1.0.4 — 2023-07-27
- 1.0.3 — 2023-07-25
- 1.0.2 — 2023-07-25
- 1.0.1 — 2023-07-24
- 1.0.0 — 2023-07-24

## README

# Nuxt MongoDB

A simple way to use mongoDB in your Nuxt 3 project.

## Usage

Install the module:

```sh
npm i -D nuxt-mongodb
```

Add `nuxt-mongodb` in the `modules` array in `nuxt.config.ts`:

```js
export default defineNuxtConfig({
  modules: ['nuxt-mongodb'],
})
```

Add your mongo connection string and main database name in your `.env` file:

```env
MONGO_CONNECTION_STRING={{your_mongo_connection_string}}
MONGO_DB={{your_mongo_db_name}}
```

When you start your project, mongo will connect and you can use it like this:

```js
import { mongo } from '#nuxt-mongodb'

const db = mongo.db()
const response = await db.collection('YOUR_COLLECTION').find()
```

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