juampi92 / adonis-mongoose-model

Mongoose models for Adonis framework.
MIT License
62 stars 17 forks source link

How to use plugin in model? #30

Closed ivybridge-3c33 closed 6 years ago

ivybridge-3c33 commented 6 years ago

how can i attach plugin to model? https://mongoosejs.com/docs/plugins.html

juampi92 commented 6 years ago
'use strict'

const BaseModel = use('MongooseModel')

/**
 * @class Foo
 */
class Foo extends BaseModel {
  static boot ({ schema }) {
    // Try to install them here
   Game.plugin(lastMod, { index: true });
  }
  /**
   * Foo's schema
   */
  static get schema () {
    return {

    }
  }
}

module.exports = Foo.buildModel('Foo')