Mixin: model

model

This mixin provides model() method as well as model class feature which overrides read() method to bless an item with the specified model class. This mixin must be loaded after storage mixin or other storage-type mixins.
Source:

Example

function Item() {} // model class

var opts = {
  storage: 'memory',
  model: Item
};
var collection = new KagoDB(opts);

collection.write('foo', {}, function(err) {
  collection.read('foo', function(err, item){
    console.log(item instanceof Item); // => true
  })
});