# @keystonejs/adapter-mongoose

> KeystoneJS Mongoose Database adapter.

Latest version **11.2.2** (published 2021-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @keystonejs/adapter-mongoose
pnpm add @keystonejs/adapter-mongoose
yarn add @keystonejs/adapter-mongoose
bun add @keystonejs/adapter-mongoose
```

## Health

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

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 11.2.2 |
| Published | 2021-05-26 |
| First published | 2019-10-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/keystonejs__adapter-mongoose) |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 6 |
| Unpacked size | 96.8 KB |
| Known vulnerabilities | 0 (+7 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 68 |
| Author | The KeystoneJS Development Team |
| Maintainers | bladey, jedwatson, molomby, jesstelford, mitchellhamilton, timl, madebymike |

## Links

- npm: https://www.npmjs.com/package/@keystonejs/adapter-mongoose
- Repository: https://github.com/keystonejs/keystone-5/tree/main/packages/adapter-mongoose
- npm.io page: https://npm.io/package/@keystonejs/adapter-mongoose

## Dependencies (6)

- [cuid](https://npm.io/package/cuid.md) ^2.1.8
- [mongoose](https://npm.io/package/mongoose.md) ^5.12.11
- [p-settle](https://npm.io/package/p-settle.md) ^4.1.1
- [@keystonejs/utils](https://npm.io/package/@keystonejs/utils.md) ^6.1.2
- [@keystonejs/keystone](https://npm.io/package/@keystonejs/keystone.md) ^19.3.3
- [@keystonejs/fields-mongoid](https://npm.io/package/@keystonejs/fields-mongoid.md) ^9.2.2

## Recent versions

- 11.2.2 (latest) — 2021-05-26
- 11.0.0 (scroll) — 2021-01-31
- 10.1.2 (quoin) — 2021-01-17
- 10.1.1 (oculus) — 2020-12-21
- 10.1.0 (nave) — 2020-12-11
- 10.0.1 (lintel) — 2020-11-03
- 10.0.0 (facade) — 2020-10-05
- 9.0.8 (dormer) — 2020-09-27
- 9.0.7 (cornice) — 2020-09-21
- 9.0.6 (buttress) — 2020-09-13
- 11.2.1 — 2021-04-14
- 11.2.0 — 2021-02-24
- 11.1.0 — 2021-02-22
- 11.0.1 — 2021-02-14
- 9.0.5 — 2020-09-06
- … 25 more at https://npm.io/package/@keystonejs/adapter-mongoose/versions

## README

<!--[meta]
section: api
subSection: database-adapters
title: Mongoose adapter
[meta]-->

# Mongoose database adapter

> This is the last active development release of this package as **Keystone 5** is now in a 6 to 12 month active maintenance phase. For more information please read our [Keystone 5 and beyond](https://github.com/keystonejs/keystone-5/issues/21) post.

[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/@keystonejs/adapter-mongoose)

## Usage

```javascript
const { MongooseAdapter } = require('@keystonejs/adapter-mongoose');

const keystone = new Keystone({
  adapter: new MongooseAdapter({...}),
});
```

## Config

### `mongoUri` (required)

This is used as the `uri` parameter for `mongoose.connect()`.

_**Default:**_ Environment variable (see below) or `'mongodb://localhost/<DATABASE_NAME>'`

If not specified, KeystoneJS will look for one of the following environment variables:

- `CONNECT_TO`
- `DATABASE_URL`
- `MONGO_URI`
- `MONGODB_URI`
- `MONGO_URL`
- `MONGODB_URL`
- `MONGOLAB_URI`
- `MONGOLAB_URL`

### Mongoose options (optional)

Additional Mongoose config options are passed directly through to `mongoose.connect()`.

_**Default:**_

```javascript
{
  useNewUrlParser: true,
  useFindAndModify: false,
  useUnifiedTopology: true,
}
```

See the [Mongoose docs](https://mongoosejs.com/docs/api.html#mongoose_Mongoose-connect) for a detailed list of options.

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