import path from 'path';

/*global emit*/

export default function bootstrap(db, cb) {
    db.createCollection('test', (err, collection) => {
        collection.defineSchema({
            number: Number,
            string: String,
            object: {
                a: Number
            },
            array: [Number],
            linked: [{
                $document: 'test',
                key: '_id',
                depth: 0
            }],
            view: {
                $view: 'test/all|count',
                display: true
            }
        });

        collection.createView('all', {
            map: (doc) => {
                emit(null, doc);
            }
        });

        cb(err);
    });
}
