This module is used to perform operations on the database Mongo. CRUD operations are performed using the query builder
You must install mongo.so extension for PHP on linux, or mongo dll extension for Windows
$result = Mongo_DB::select(array('title', 'caption'))
->from('mydb', 'mycol')
->where(array('likes' => 100))
->execute()
->as_array();
$result = Mongo_DB::select()
->from('mydb', 'mycol')
->just_one()
->execute()
->current();
$document = array(
"title" => "Foo boo",
"description" => "test description",
"likes" => 10,
"url" => "www.xxxx.com",
"by", "Author"
);
Mongo_DB::insert('mydb', 'mycol', $document)
->execute();
$data = array(
"title" => "FOO BOO"
);
Mongo_DB::update('mydb', 'mycol', $data)
->where(array("title" => "Foo boo"))
->multiple()
->execute();
Mongo_DB::delete('mydb', 'mycol')
->where(array("likes" => 100))
->just_one()
->execute();
mongo.php
return array
(
'default' => array
(
'host' => 'localhost',
'port' => 27017,
'default_database' => 'kohana',
'default_collection' => 'kohana_collection'
),
);