import mongoose from 'mongoose' ; import { PersistenceType } from './PersistenceType' ; class PersistenceConnectionInitializer { init ( type , options ) { switch ( type ) { case PersistenceType . MongoDb : this . initMongo ( options ) ; break ; } } private initMongo ( { databaseUrl , databaseName } ) { mongoose . connect ( `mongodb://${ databaseUrl }/${ databaseName }` , { useNewUrlParser : true , useFindAndModify : false , } ) ; } } export default PersistenceConnectionInitializer ;