Skip to content

mongodb-model/db-migration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base

Standalone base module extending the NodeJs Transform API with few other functionalities added

Installation

$ yarn add @mongodb-model/schema 

or

$ npm i @mongodb-model/schema

Simple Usage Example

 const Base = require('@mongodb-model/schema');
 const base = new Base();
 base.apiGet();
 base.on('apiGet', data => console.log(data));
 base.on('apiGet-error', error => console.error(error));
 

or

 class MyWonderfulClass extends require('@mongodb-model/schema') {

    constructor(...arrayOfObjects) {

    super({ objectMode: true, encoding: "utf-8", autoDestroy: true });

    arrayOfObjects.forEach(option => {
        if(Object.keys(option).length > 0){
            Object.keys(option).forEach((key) => { if(!this[key]) this[key] = option[key];})
        }
    });

    this.autobind(MyWonderfulClass);
    this.autoinvoker(MyWonderfulClass);
    this.setMaxListeners(Infinity);
  }
 };
 

Releases

No releases published

Packages

No packages published