<commit_before><?php
/**
 * This class wraps the functionality of Mongo (connection) and MongoDB (database object) into one class.
 * When used with Kohana it can be instantiated simply by:
 *
 * <code>
 *  $db = Mongo_Database::instance();
 * </code>
 * 
 * The above will assume the 'default' configuration from the APPPATH/config/mongo.php file.
 * Alternatively it may be instantiated with the name and configuration specified as arguments:
 *
 * <code>
 *   $db = Mongo_Database::instance('test', array(
 *     'database' => 'test'
 *   ));
 * </code>
 *
 * The Mongo_Collection class will gain access to the server by calling the instance method with a configuration name,
 * so if not using Kohana or the configuration name is not present in the config file then the instance should be created
 * before using any classes that extend Mongo_Collection or Mongo_Document.
 *
 * Mongo_Database can proxy all methods of MongoDB to the database instance as well as select collections using the __get
 * magic method.
 *
 * If using Kohana, profiling can be enabled/disabled via the configuration or on demand by setting the profiling property.
 *
 * @method array authenticate()  authenticate( string $username , string $password )
 * @method array command()  command( array $data )
 * @method MongoCollection createCollection()  createCollection( string $name [, bool $capped = FALSE [, int $size = 0 [, int $max = 0 ]]] )
 * @method array createDBRef()  createDBRef( mixed $ns , mixed $a )
 * @method array drop()  drop( void )
 * @method array dropCollection()  dropCollection( mixed $coll )
 * @method bool forceError()  forceError( void )
 * @method array getDBRef()  getDBRef( array $ref )
 * @method MongoGridFS getGridFS()  getGridFS([ string $arg1 = "fs" [, string $arg2 = NULL ]] )
 * @method int getProfilingLevel()  getProfilingLevel( void )
 * @method array lastError()  lastError( void )
 * @method array listCollections()  listCollections( void )
 * @method array prevError()  prevError( void )
 * @method array repair()  repair([ bool $preserve_cloned_files = FALSE [, bool $backup_original_files = FALSE ]] )
 * @method array resetError()  resetError( void )
 * @method MongoCollection selectCollection()  selectCollection( string $name )
 * @method int setProfilingLevel()  setProfilingLevel( int $level )
 *
 * @author  <NAME>
 * @package Mongo_Database
 *
 * This class was adapted from http://github.com/Wouterrr/MangoDB
 */

class Mongo_Database {
<commit_msg>Add contants for BSON types.<commit_after><?php
/**
 * This class wraps the functionality of Mongo (connection) and MongoDB (database object) into one class.
 * When used with Kohana it can be instantiated simply by:
 *
 * <code>
 *  $db = Mongo_Database::instance();
 * </code>
 * 
 * The above will assume the 'default' configuration from the APPPATH/config/mongo.php file.
 * Alternatively it may be instantiated with the name and configuration specified as arguments:
 *
 * <code>
 *   $db = Mongo_Database::instance('test', array(
 *     'database' => 'test'
 *   ));
 * </code>
 *
 * The Mongo_Collection class will gain access to the server by calling the instance method with a configuration name,
 * so if not using Kohana or the configuration name is not present in the config file then the instance should be created
 * before using any classes that extend Mongo_Collection or Mongo_Document.
 *
 * Mongo_Database can proxy all methods of MongoDB to the database instance as well as select collections using the __get
 * magic method.
 *
 * If using Kohana, profiling can be enabled/disabled via the configuration or on demand by setting the profiling property.
 *
 * @method array authenticate()  authenticate( string $username , string $password )
 * @method array command()  command( array $data )
 * @method MongoCollection createCollection()  createCollection( string $name [, bool $capped = FALSE [, int $size = 0 [, int $max = 0 ]]] )
 * @method array createDBRef()  createDBRef( mixed $ns , mixed $a )
 * @method array drop()  drop( void )
 * @method array dropCollection()  dropCollection( mixed $coll )
 * @method bool forceError()  forceError( void )
 * @method array getDBRef()  getDBRef( array $ref )
 * @method MongoGridFS getGridFS()  getGridFS([ string $arg1 = "fs" [, string $arg2 = NULL ]] )
 * @method int getProfilingLevel()  getProfilingLevel( void )
 * @method array lastError()  lastError( void )
 * @method array listCollections()  listCollections( void )
 * @method array prevError()  prevError( void )
 * @method array repair()  repair([ bool $preserve_cloned_files = FALSE [, bool $backup_original_files = FALSE ]] )
 * @method array resetError()  resetError( void )
 * @method MongoCollection selectCollection()  selectCollection( string $name )
 * @method int setProfilingLevel()  setProfilingLevel( int $level )
 *
 * @author  <NAME>
 * @package Mongo_Database
 *
 * This class was adapted from http://github.com/Wouterrr/MangoDB
 */

class Mongo_Database {

  /* See http://bsonspec.org */
  const TYPE_DOUBLE        = 1;
  const TYPE_STRING        = 2;
  const TYPE_OBJECT        = 3;
  const TYPE_ARRAY         = 4;
  const TYPE_BINARY        = 5;
  const TYPE_OBJECTID      = 7;
  const TYPE_BOOLEAN       = 8;
  const TYPE_DATE          = 9;
  const TYPE_NULL          = 10;
  const TYPE_REGEX         = 11;
  const TYPE_CODE          = 13;
  const TYPE_SYMBOL        = 14;
  const TYPE_CODE_SCOPED   = 15;
  const TYPE_INT32         = 16;
  const TYPE_TIMESTAMP     = 17;
  const TYPE_INT64         = 18;
  const TYPE_MIN_KEY       = 255;
  const TYPE_MAX_KEY       = 127;

{'fraction_non_alphanumeric': 0.09867951463240543, 'fraction_numerical': 0.007494646680942184, 'mean_word_length': 3.7946963216424296, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2942711', 'n_tokens_mistral': 1660, 'n_tokens_neox': 1567, 'n_words': 614}