egg-mongoose
Egg's mongoose plugin.
Install
$ npm i egg-mongoose --save
Usage
// {app_root}/config/plugin.jsexportsmongoose = enable: true package: 'egg-mongoose';
Configuration
// {app_root}/config/config.default.jsexportsmongoose = url: 'mongodb://127.0.0.1/example' options: {};
see config/config.default.js for more detail.
Multi-mongos support
// {app_root}/config/config.default.jsexportsmongoose = url: 'mongodb://mongosA:27501,mongosB:27501' options: {};
Example
// app/model/user.jsmodule { const UserSchema = userName: type: String password: type: String ; return mongoose;} // app/controller/user.jsexports { ctxbody = ctxmodeluser;}
Questions & Suggestions
Please open an issue here.
Contribution
If you are a contributor, follow CONTRIBUTING.