PHP Class Kohana_MangoDB

Mostrar archivo Open project: wouterrr/mangodb

Public Properties

Property Type Description
$default default instance name
$instances Database instances

Protected Properties

Property Type Description
$_config Configuration
$_connected Connected
$_connection Mongo object
$_db MongoDB object
$_name Instance name

Public Methods

Method Description
__toString ( )
aggregate ( $collection_name )
batch_insert ( $collection_name, array $a, array $options = [] ) Data Management
command ( array $data )
connect ( ) Connect to database
connected ( ) Returns connection status
count ( $collection_name, array $query = [] )
create_collection ( $name, $capped = FALSE, $size, $max ) Collection management
db ( )
disconnect ( ) Disconnect from database
drop_collection ( $name )
ensure_index ( $collection_name, $keys, $options = [] )
execute ( $code, array $args = [] )
find ( $collection_name, array $query = [], array $fields = [] )
find_one ( $collection_name, array $query = [], array $fields = [] )
get_file ( array $criteria = [] )
get_files ( array $query = [], array $fields = [] )
gridFS ( ) File management
group ( $collection_name, $keys, array $initial, $reduce, array $condition = [] )
insert ( $collection_name, array $a, $options = [] )
instance ( $name = NULL, array $config = NULL ) : Database Get a singleton MangoDB instance. If configuration is not specified, it will be loaded from the MangoDB configuration file using the same group as the name.
last_error ( ) Database Management
prev_error ( )
remove ( $collection_name, array $criteria, $options = [] )
remove_file ( array $criteria = [], array $options = [] )
reset_error ( )
save ( $collection_name, array $a, $options = [] )
set_file ( $filename, array $extra = [], array $options = [] )
set_file_bytes ( $bytes, array $extra = [], array $options = [] )
update ( $collection_name, array $criteria, array $newObj, $options = [] )

Protected Methods

Method Description
__construct ( $name, array $config )
_call ( $command, array $args = [], array $values = NULL ) All commands for which benchmarking could be useful are executed by this method

Method Details

__construct() protected method

protected __construct ( $name, array $config )
$config array

__toString() final public method

final public __toString ( )

_call() protected method

This allows for easy benchmarking
protected _call ( $command, array $args = [], array $values = NULL )
$args array
$values array

aggregate() public method

public aggregate ( $collection_name )

batch_insert() public method

Data Management
public batch_insert ( $collection_name, array $a, array $options = [] )
$a array
$options array

command() public method

public command ( array $data )
$data array

connect() public method

Connect to database
public connect ( )

connected() public method

Returns connection status
public connected ( )

count() public method

public count ( $collection_name, array $query = [] )
$query array

create_collection() public method

Collection management
public create_collection ( $name, $capped = FALSE, $size, $max )

db() public method

public db ( )

disconnect() public method

Disconnect from database
public disconnect ( )

drop_collection() public method

public drop_collection ( $name )

ensure_index() public method

public ensure_index ( $collection_name, $keys, $options = [] )

execute() public method

public execute ( $code, array $args = [] )
$args array

find() public method

public find ( $collection_name, array $query = [], array $fields = [] )
$query array
$fields array

find_one() public method

public find_one ( $collection_name, array $query = [], array $fields = [] )
$query array
$fields array

get_file() public method

public get_file ( array $criteria = [] )
$criteria array

get_files() public method

public get_files ( array $query = [], array $fields = [] )
$query array
$fields array

gridFS() public method

File management
public gridFS ( )

group() public method

public group ( $collection_name, $keys, array $initial, $reduce, array $condition = [] )
$initial array
$condition array

insert() public method

public insert ( $collection_name, array $a, $options = [] )
$a array

instance() public static method

Load the default database $db = MangoDB::instance(); Create a custom configured instance $db = MangoDB::instance('custom', $config);
public static instance ( $name = NULL, array $config = NULL ) : Database
$config array
return Database

last_error() public method

Database Management
public last_error ( )

prev_error() public method

public prev_error ( )

remove() public method

public remove ( $collection_name, array $criteria, $options = [] )
$criteria array

remove_file() public method

public remove_file ( array $criteria = [], array $options = [] )
$criteria array
$options array

reset_error() public method

public reset_error ( )

save() public method

public save ( $collection_name, array $a, $options = [] )
$a array

set_file() public method

public set_file ( $filename, array $extra = [], array $options = [] )
$extra array
$options array

set_file_bytes() public method

public set_file_bytes ( $bytes, array $extra = [], array $options = [] )
$extra array
$options array

update() public method

public update ( $collection_name, array $criteria, array $newObj, $options = [] )
$criteria array
$newObj array

Property Details

$_config protected_oe property

Configuration
protected $_config

$_connected protected_oe property

Connected
protected $_connected

$_connection protected_oe property

Mongo object
protected $_connection

$_db protected_oe property

MongoDB object
protected $_db

$_name protected_oe property

Instance name
protected $_name

$default public_oe static_oe property

default instance name
public static $default

$instances public_oe static_oe property

Database instances
public static $instances