@davidsemakula/keystone-adapter-mongoose

8.1.3-alpha.1 • Public • Published

Mongoose database adapter

View changelog

Usage

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

const keystone = new Keystone({
  name: 'My Awesome Project',
  adapter: new MongooseAdapter({...}),
});

Config

mongoUri (optional)

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

Default: Environmental variable (see below) or 'mongodb://localhost/<DATABASE_NAME>'

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

  • CONNECT_TO
  • DATABASE_URL
  • MONGO_URI
  • MONGODB_URI
  • MONGO_URL
  • MONGODB_URL
  • MONGOLAB_URI
  • MONGOLAB_URL

If none of these are found a connection string is derived with a DATABASE_NAME from the KeystoneJS project name.

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 @davidsemakula/keystone-adapter-mongoose

Weekly Downloads

2

Version

8.1.3-alpha.1

License

MIT

Unpacked Size

62.7 kB

Total Files

5

Last publish

Collaborators

  • davidsemakula