__construct()
add_index()
command()
count()
delete()
delete_all()
drop_collection()
drop_db()
dump()
get()
get_collection()
get_cursor()
get_one()
get_where()
insert()
instance()
like()
limit()
list_collections()
list_indexes()
offset()
or_where()
order_by()
remove_all_indexes()
remove_index()
select()
update()
update_all()
where()
where_between()
where_between_ne()
where_gt()
where_gte()
where_in()
where_in_all()
where_lt()
where_lte()
where_ne()
where_near()
where_not_in()
_clear()
_where_init()
_write_dump()
$wheres
$connection
$db
$instances
$limit
$offset
$persist
$profiling
$selects
$sorts
__construct(array $config)
Generate the connection string and establish a connection to the MongoDB.
array
an array of config values
\Mongo_DbException |
---|
add_index(string $collection, array $keys, array $options) : \Fuel\Core\Mongo_Db
To set values to descending order, you must pass values of either -1, false, 'desc', or 'DESC', else they will be set to 1 (ASC).
usage | $mongodb->add_index($collection, array('first_name' => 'ASC', 'last_name' => -1), array('unique' => TRUE)); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the collection name
array
an associative array of keys, array(field => direction)
array
an associative array of options
\Mongo_DbException |
---|
command(array $query) : mixed
See the MongoDB documentation for more usage scenarios: http://dochub.mongodb.org/core/commands
usage | $mongodb->command(array('geoNear'=>'buildings', 'near'=>array(53.228482, -0.547847), 'num' => 10, 'nearSphere'=>TRUE)); |
---|
array
a query array
\Mongo_DbException |
---|
mixed
count(string $collection, boolean $foundonly) : mixed
usage | $mongodb->count('foo'); |
---|
string
the collection name
boolean
send cursor limit and skip information to the count function, if applicable.
\Mongo_DbException |
---|
mixed
delete(string $collection) : bool
usage | $mongodb->delete('foo'); |
---|
string
the collection name
\Mongo_DbException |
---|
bool
delete_all(string $collection) : bool
usage | $mongodb->delete_all('foo'); |
---|
string
the collection name
\Mongo_DbException |
---|
bool
drop_collection(string $db, string $col) : bool
usage | $mongodb->drop_collection('foo', 'bar'); |
---|
string
the database name
string
the collection name
\Mongo_DbException |
---|
bool
drop_db(string $database) : bool
usage | $mongodb->drop_db("foobar"); |
---|
string
the database name
\Mongo_DbException |
---|
bool
dump(mixed $collection_name, string $path) : bool
usage | $mongodb->dump(); |
---|---|
usage | $mongodb->dump(test, APPPATH . "tmp"); |
usage | $mongodb->dump(["test", "test2"], APPPATH . "tmp"); |
mixed
The collection name
string
Path to write the dump do
bool
get(string $collection) : array
usage | $mongodb->get('foo', array('bar' => 'something')); |
---|
string
the collection name
\Mongo_DbException |
---|
array
get_collection(string $collection)
usage | $collection_name = $mongodb->get_collection('collection_name'); |
---|
string
the collection name
get_cursor(string $collection)
usage | $mongodb->get_cursor('foo', array('bar' => 'something')); |
---|
string
the collection name
\Mongo_DbException |
---|
get_one(string $collection) : mixed
usage | $mongodb->get_one('foo'); |
---|
string
the collection name
\Mongo_DbException |
---|
mixed
get_where(string $collection, array $where, integer $limit) : array
usage | $mongodb->get_where('foo', array('bar' => 'something')); |
---|
string
the collection name
array
an array of conditions, array(field => value)
integer
the max amount of documents to fetch
array
insert(string $collection, array $insert) : bool
Insert a new document into the passed collection
usage | $mongodb->insert('foo', $data = array()); |
---|
string
the collection name
array
an array of values to insert, array(field => value)
\Mongo_DbException |
---|
bool
instance(string $name) : \Fuel\Core\Mongo_Db
Will return the requested instance, or will create a new one if it does not exist.
string
The instance name
\Mongo_DbException |
---|
like(string $field, string $value, string $flags, bool $disable_start_wildcard, bool $disable_end_wildcard) : \Fuel\Core\Mongo_Db
Get the documents where the (string) value of a $field is like a value. The defaults allow for a case-insensitive search.
usage | $mongodb->like('foo', 'bar', 'im', false, true); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
string
string
Allows for the typical regular expression flags: i = case insensitive m = multiline x = can contain comments l = locale s = dotall, "." matches everything, including newlines u = match unicode
bool
If this value evaluates to false, no starting line character "^" will be prepended to the search value, representing only searching for a value at the start of a new line.
bool
If this value evaluates to false, no ending line character "$" will be appended to the search value, representing only searching for a value at the end of a line.
limit(integer $x) : \Fuel\Core\Mongo_Db
usage | $mongodb->limit($x); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
integer
the max amount of documents to fetch
list_collections(bool $system_collections)
usage | $collections = $mongodb->list_collections(); |
---|
bool
whether or not to include system collections
list_indexes(string $collection) : mixed
usage | $mongodb->list_indexes($collection); |
---|
string
the collection name
\Mongo_DbException |
---|
mixed
offset(integer $x) : \Fuel\Core\Mongo_Db
Offset the result set to skip $x number of documents
usage | $mongodb->offset($x); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
integer
the number of documents to skip
or_where(array $wheres) : \Fuel\Core\Mongo_Db
usage | $mongodb->or_where(array( array('foo'=>'bar', 'bar'=>'foo' ))->get('foobar'); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
array
an associative array with conditions, array(field => value)
order_by(array $fields) : \Fuel\Core\Mongo_Db
To set values to descending order, you must pass values of either -1, false, 'desc', or 'DESC', else they will be set to 1 (ASC).
usage | $mongodb->where_between('foo', 20, 30); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
array
an associative array, array(field => direction)
remove_all_indexes(string $collection) : \Fuel\Core\Mongo_Db
usage | $mongodb->remove_all_index($collection); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the collection name
\Mongo_DbException |
---|
remove_index(string $collection, array $keys) : \Fuel\Core\Mongo_Db
To set values to descending order, you must pass values of either -1, false, 'desc', or 'DESC', else they will be set to 1 (ASC).
usage | $mongodb->remove_index($collection, array('first_name' => 'ASC', 'last_name' => -1)); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the collection name
array
an associative array of keys, array(field => direction)
\Mongo_DbException |
---|
select(array $includes, array $excludes) : \Fuel\Core\Mongo_Db
Currently, including and excluding at the same time is not available, so the $includes array will take precedence over the $excludes array. If you want to only choose fields to exclude, leave $includes an empty array().
usage | $mongodb->select(array('foo', 'bar'))->get('foobar'); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
array
which fields to include
array
which fields to exclude
update(string $collection, array $data, array $options, bool $literal) : bool
usage | $mongodb->update('foo', $data = array()); |
---|
string
the collection name
array
an associative array of values, array(field => value)
array
an associative array of options
bool
\Mongo_DbException |
---|
bool
update_all(string $collection, array $data, bool $literal) : bool
usage | $mongodb->update_all('foo', $data = array()); |
---|
string
the collection name
array
an associative array of values, array(field => value)
bool
\Mongo_DbException |
---|
bool
where(array $wheres) : \Fuel\Core\Mongo_Db
The $wheres array should be an associative array with the field as the key and the value as the search criteria.
usage | $mongodb->where(array('foo' => 'bar'))->get('foobar'); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
array
an associative array with conditions, array(field => value)
where_between(string $field, mixed $x, mixed $y) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_between('foo', 20, 30); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
mixed
the value to compare to
mixed
the high value to compare to
where_between_ne(string $field, mixed $x, mixed $y) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_between_ne('foo', 20, 30); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
mixed
the low value to compare to
mixed
the high value to compare to
where_gt(string $field, mixed $x) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_gt('foo', 20); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
mixed
the value to compare to
where_gte(string $field, mixed $x) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_gte('foo', 20); |
---|
string
the field name
mixed
the value to compare to
where_in(string $field, array $in) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_in('foo', array('bar', 'zoo', 'blah'))->get('foobar'); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
array
an array of values to compare to
where_in_all(string $field, array $in) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_in('foo', array('bar', 'zoo', 'blah'))->get('foobar'); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
array
an array of values to compare to
where_lt(string $field, mixed $x) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_lt('foo', 20); |
---|
string
the field name
mixed
the value to compare to
where_lte(string $field, mixed $x) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_lte('foo', 20); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
mixed
the value to compare to
where_ne(string $field, mixed $x) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_not_equal('foo', 1)->get('foobar'); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
mixed
the value to compare to
where_near(string $field, array $co) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_near('foo', array('50','50'))->get('foobar'); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
array
array of 2 coordinates
where_not_in(string $field, array $in) : \Fuel\Core\Mongo_Db
usage | $mongodb->where_not_in('foo', array('bar', 'zoo', 'blah'))->get('foobar'); |
---|---|
fluent | This method is part of a fluent interface and will return the same instance |
string
the field name
array
an array of values to compare to
_clear()
_where_init(string $param)
string
the field name
_write_dump(string $path, \Fuel\Core\MongoCollection $mongo_collection)
string
\Fuel\Core\MongoCollection
$wheres : array
$connection : \Fuel\Core\Mongo
$db : Object
$instances : array
$limit : int
$offset : int
$persist : bool
$profiling : bool
$selects : array
$sorts : array