<commit_before>var Oriento = require('oriento'),
    Q = require('q'),
    async = require('async'),
    _ = require('underscore'),
    utils = require('./utils'),
    Query = require('./query');

module.exports = (function () {

    'use strict';

    var defaults = {
            createCustomIndex: false,
            idProperty: 'id'
        },
        server, transformers = {
            '@rid': function (rid) {
                return '#' + rid.cluster + ':' + rid.position;
            }
        },
        dbHelper = function (db, collections, config) {
            this.db = db;
            this.collections = collections;
            this.config = _.extend(config, defaults);
        },
        ensureDB = function (database) {
        	var dbProps = (typeof database === 'object') ? database : { name: database };
            var deferred = Q.defer();
            server.list().then(function (dbs) {
                var dbExists = _.find(dbs, function (db) {
                    return db.name === dbProps.name;
                });
                if (dbExists) {
                    deferred.resolve(server.use(dbProps));
                } else {
                    server.create(dbProps).then(function (db) {
                        deferred.resolve(db);
                    });
                }


            });
<commit_msg>Making database defaults explicit in connection.js<commit_after>var Oriento = require('oriento'),
    Q = require('q'),
    async = require('async'),
    _ = require('underscore'),
    utils = require('./utils'),
    Query = require('./query');

module.exports = (function () {

    'use strict';

    var defaults = {
            createCustomIndex: false,
            idProperty: 'id'
        },
        dbDefaults = {
        	type: 'graph',
        	storage: 'plocal'
        },
        server, 
        transformers = {
            '@rid': function (rid) {
                return '#' + rid.cluster + ':' + rid.position;
            }
        },
        dbHelper = function (db, collections, config) {
            this.db = db;
            this.collections = collections;
            this.config = _.extend(config, defaults);
        },
        ensureDB = function (database) {
        	var dbProps = (typeof database === 'object') ? database : { name: database };
        	dbProps = _.extend(dbProps, dbDefaults);
            var deferred = Q.defer();
            server.list().then(function (dbs) {
                var dbExists = _.find(dbs, function (db) {
                    return db.name === dbProps.name;
                });
                if (dbExists) {
                    deferred.resolve(server.use(dbProps));
                } else {
                    server.create(dbProps).then(function (db) {
                        deferred.resolve(db);
                    });
                }


            });

{'fraction_non_alphanumeric': 0.1355221795319595, 'fraction_numerical': 0.0, 'mean_word_length': 1.4230118443316413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7345331', 'n_tokens_mistral': 761, 'n_tokens_neox': 724, 'n_words': 159}