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

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

// const PROJECT_ID = process.env.PROJECT_ID;

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

    const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);

    const doc = await eventRepo.projectEventFieldsById(
        { id: 'blzoa1w8g' },
        ['location', 'project', 'startDate', 'typeOf', 'superEvent.id', 'superEvent.location.id', 'offers.itemOffered']
    );
    // tslint:disable-next-line:no-null-keyword
    console.dir(doc, { depth: null });
}

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