Skip to content
This repository has been archived by the owner on Jul 9, 2018. It is now read-only.

Latest commit

 

History

History
31 lines (24 loc) · 1.17 KB

README.md

File metadata and controls

31 lines (24 loc) · 1.17 KB

travetto: Model-Mongo

This module provides an mongodb-based implementation of ModelSource for the Model module. This source allows the Model module to read, write and query against elasticserch. Given the dynamic nature of mongodb, during development when models are modified, nothing needs to be done to adapt to the latest schema.

All that is needed to use the ModelSource is to register it with the Dependency Injection module.

export class Init {
  @InjectableFactory()
  static getModelSource(conf: ModelMongoConfig): ModelSource {
    return new ModelMongoSource(conf);
  }
}

where the ModelMongoConfig is defined by:

@Config('model.mongo')
export class ModelMongoConfig {
  hosts = 'localhost';
  namespace = 'app';
  port = 27017;
  options = {};
}

and can be overridden via environment variables or config files, as defined in Config.

NOTE During testing, the source will automatically spin up a mongodb server via a docker container if you are not already running the service.