Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Can't get started with MongDB
  • Hi! I am trying to get started with MongoDB and FuelPHP 1.2.1. I have set up connection parameters in app/config/db.php as per the docs: 'mongo' => array(
    // This group is used when no instance name has been provided.
    'default' => array(
    'hostname' => 'localhost',
    'database' => 'test',
    ),
    ), A test action method in welcome controller is as follows: public function action_test()
    {
    $m=\Mongo_Db::instance('default');
    $m->insert('faltu',array('foo'=>'bar1'));
    return Response::forge("");
    } However, when I access the relevant page, the following error is shown: 8192! ErrorException [ 8192 ]: Mongo::__construct(): The 'connect' option is deprecated and will be removed in the future COREPATH/classes/mongo/db.php @ line 178: 177: {
    178: $this->connection = new \Mongo(trim($connection_string), $options);
    179: $this->db = $this->connection->{$config};
    The database is being populated with the correct data though. What am I missing?
    Thanks.
  • You're not "missing" something.
    The warning is about a future plan to remove the "connect" option for Mongodb. It works now, but you should consider changing to the currently accepted format. I don't know Mongodb, so I can't advise on what the new format is, but the message is only a warning and the operation completed as you would expect.
  • Okay. Changing Line# 140 of the core file core/classes/mongo/db.php
    from:
    $options = array("connect" => true);
    to:
    $options = array(); makes the ugly warning/error message disappear just as expected! Guess its an upstream "bug".
  • Please make an issue for this on http://github.com/fuel/core/issues so it can be fixed.
  • Harro Verton wrote on Monday 20th of August 2012:
    Please make an issue for this on http://github.com/fuel/core/issues so it can be fixed.

    Done.
    https://github.com/fuel/core/issues/1110

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion