co-koa-mongoose-plugin
v1.8.1
Published
[](https://travis-ci.org/jaysaurus/co-koa-mongoose-plugin.svg?branch=master) [;
const mongoosePlugin = require('co-koa-mongoose-plugin');
if (fs.existsSync('./node_modules')) {
const CoKoa = require('co-koa-core');
try {
const coKoa = CoKoa(__dirname).launch(mongoosePlugin()); // <= HERE!
...The mongoosePlugin can optionally be called with a configuration object. The default configuration object is as below:
SessionPlugin({
connectionString = 'mongodb://localhost:27017/coKoa',
promise = global.Promise,
plugins = undefined
})The connectionString property expects either a list of strings or an object containing environment properties matching those supplied to your Co.Koa environment at launch (see installation & execution documentation for more information):
connectionString: {
development: 'mongodb://etc',
test: 'mongodb://etc',
etc: 'mongodb://etc',
}
...the promise property expects a promise library for mongoose to use on asynchronous requests. You are strongly encouraged to supply an alternative promise library to mongoose. At the time of writing, the global promise library is significantly slower than other promise libraries (see, for example bluebird)
the plugins property can be supplied an array of additional Co.Koa plugins. These should point to methods based on the boilerplate below:
(mongoose) => {
...
return {
init (app, $) => {
...
}
}
}