skyer-mongoose-component
Skyer mongoose component.
Install
$ npm i --save skyer-mongoose-component
Register
/app/components/mongoose.component.js
moduleexports = ;
Usage
const mongoose = ; const mongooseConn = skyercomponentManager; const blogSchema = title: String author: String body: String comments: body: String date: Date date: type: Date default: Datenow hidden: Boolean meta: votes: Number favs: Number ; const Blog = mongooseConn; const blog = Blog;
Or
Build skyer-mongoose-component with model_path options.
const mongooseConn = skyercomponentManager; const UserLoginLogModel = mongooseConn; const log = UserLoginLogModel;
Events
See mongoose
connection events
If you want to listen mongoose connection events , you can inherits MongooseComponent then do your listen logic.
/app/components/mongoose.component.js
const MongooseComponent = ; { superoptions; this; } { this; this; } moduleexports = YourMongooseComponent;
Options
See mongoose
connection options
and Mongoose-createConnection
Example
See skyer-example