mongoose-plugin-compose

0.0.2 • Public • Published

Build Status Coverage Status

Mongoose Plugin Compose

Defer commitment to the ORM. Separate your domain models from your persistence models.

const compose = require('mongoose-plugin-compose').default;

class Animal {
  speak(){
    console.log(this.name)
  }
}

const Cat = mongoose.model('Cat', new mongoose.Schema({
  name: String
}));

Cat.schema.plugin(compose(Animal));

const cat = new Cat({ name: 'fido'});

cat.speak(); // fido

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    0
  • 0.0.1
    1
  • 0.0.0
    1

Package Sidebar

Install

npm i mongoose-plugin-compose

Weekly Downloads

2

Version

0.0.2

License

MIT

Last publish

Collaborators

  • blugavere