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

const startTime = process.hrtime();
import { chevre } from '../../../lib/index';
const diff = process.hrtime(startTime);
console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);

// const PROJECT_ID = process.env.PROJECT_ID;

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

    const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);

    const doc = await actionRepo.findById(
        {
            id: '66cc6030fe3d4df76011aa75',
            typeOf: chevre.factory.actionType.DeleteAction
        },
        ['id', 'actionStatus'],
        []
    );
    // tslint:disable-next-line:no-null-keyword
    console.dir(doc, { depth: null });
}

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