@keystonejs/adapter-mongoose
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/keystonejs__adapter-mongoose package

11.2.2 • Public • Published

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 post.

View changelog

Usage

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:

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

See the Mongoose docs for a detailed list of options.

Readme

Keywords

none

Package Sidebar

Install

npm i @keystonejs/adapter-mongoose

Weekly Downloads

899

Version

11.2.2

License

MIT

Unpacked Size

99.1 kB

Total Files

9

Last publish

Collaborators

  • emmatown
  • jedwatson
  • molomby
  • bladey