// tslint:disable:no-console
import * as mongoose from 'mongoose';

import { chevre } from '../../../lib/index';

const PROJECT_ID = String(process.env.PROJECT_ID);

async function main() {
    await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });

    const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);

    await projectRepo.activateOptionalAggregationSettings({ id: PROJECT_ID });
    console.log('activated.');
}

main()
    .then(console.log)
    .catch(console.error);
