<commit_before>'use strict'

var mongojs = require('mongojs');
var Promise = require('promise');
var Database = require('./lib/database');

// ObjectId
module.exports = function (connString, cols, options) {
  var connection = mongojs.apply(null, arguments);
  var db = new Database(connection);
  cols = cols || [];
  cols.forEach(function (colName) {
    db[colName] = db.collection(colName);

    var parts = colName.split('.');

    var last = parts.pop();
    var parent = parts.reduce(function (parent, prefix) {
      parent[prefix] = parent[prefix] || {};
      return parent[prefix];
    }, db);

    parent[last] = db.collection(colName);
  })
  return db;
};<commit_msg>Expose underlying BSON types from MongoJS (#10)<commit_after>'use strict'

var mongojs = require('mongojs');
var Promise = require('promise');
var Database = require('./lib/database');

// ObjectId
module.exports = function (connString, cols, options) {
  var connection = mongojs.apply(null, arguments);
  var db = new Database(connection);
  cols = cols || [];
  cols.forEach(function (colName) {
    db[colName] = db.collection(colName);

    var parts = colName.split('.');

    var last = parts.pop();
    var parent = parts.reduce(function (parent, prefix) {
      parent[prefix] = parent[prefix] || {};
      return parent[prefix];
    }, db);

    parent[last] = db.collection(colName);
  })
  return db;
};

// expose bson stuff visible in the shell
module.exports.Binary     = mongojs.Binary      ;
module.exports.Code       = mongojs.Code        ;
module.exports.DBRef      = mongojs.DBRef       ;
module.exports.Double     = mongojs.Double      ;
module.exports.Long       = mongojs.Long        ;
module.exports.NumberLong = mongojs.NumberLong  ;
module.exports.MinKey     = mongojs.MinKey      ;
module.exports.MaxKey     = mongojs.MaxKey      ;
module.exports.ObjectID   = mongojs.ObjectID    ;
module.exports.ObjectId   = mongojs.ObjectId    ;
module.exports.Symbol     = mongojs.Symbol      ;
module.exports.Timestamp  = mongojs.Timestamp   ;
{'fraction_non_alphanumeric': 0.14173614516920058, 'fraction_numerical': 0.000980872976949485, 'mean_word_length': 3.25, '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': '1228739', 'n_tokens_mistral': 645, 'n_tokens_neox': 632, 'n_words': 139}