app/config/db.php: 'mongo' => array( // This group is used when no instance name has been provided. 'default' => array( 'hostname' => 'localhost', 'database' => 'fuel', ), // List your own groups below. 'my_mongo_connection' => array( 'hostname' => 'localhost', 'database' => 'my_db', 'username' => 'user', 'password' => 'p@s$w0rD', ), ),And I can use it like this:
app/classes/controller/home.php: public function action_index() { $m = Mongo_Db::instance('default'); $insert_id = $m->insert('users', array( 'name' => 'John', 'surname' => 'Doe', 'email' => 'dont.em@ilme.com', )); $this->response->body = View::factory('home', array( 'insert_id' => $insert_id, )); }The Above code works without problems. So, the questions are: 1) why is config for MongoDB written in such way? With Mongo (as with MySQL and other DBs) I would expect to have one config for testing, another for production... Like this:
Fuel::DEVELOPMENT => array( 'type' => 'mongo', 'connection' => array( 'hostname' => 'localhost', 'database' => 'fuel_dev', 'username' => 'root', 'password' => '', ), ),Of course, I can always do sth. like this:
'mongo' => array( Fuel::DEVELOPMENT => array( ... ), Fuel::PRODUCTION => array( ... ), ),But this makes MongoDB feel like second-class citizen next to MySQL and others. Is there a reason for this inconsistency? 2) I would like to use ORM with MongoDB. What is the recommended way? I have found this:
It looks like you're new here. If you want to get involved, click one of these buttons!