Open fredrikpaulin opened 11 years ago
You are probably using PHP5.4, which triggers strict warnings if function arguments are of the wrong type.
I fixed this by editing the MongodbSource.php, near line 466, you will find a:
->insert($data, true);
change it to
->insert($data, array());
Btw, which Mongo driver version are you using?
This is an issue with changes to the MongoCollection::insert function in the PHP driver.
See the changelog here: http://www.php.net/manual/en/mongocollection.insert.php
To get the previous behaviour (ie to support legacy code) change the line dizyart mentions as follows
- ->insert($data, true);
+ ->insert($data, array('w' => 1));
This causes the driver to return a true boolean on success instead of an array.
Warning (4096): Argument 2 passed to MongoCollection::insert() must be of the type array, boolean given, called in /var/www/lib/Cake/Model/Model.php on line 1734 and defined [APP/Plugin/Mongodb/Model/Datasource/MongodbSource.php, line 465] Notice (8): Undefined index: _id [APP/Plugin/Mongodb/Model/Datasource/MongodbSource.php, line 476] Notice (8): Undefined index: _id [APP/Plugin/Mongodb/Model/Datasource/MongodbSource.php, line 477]
And the code: $note = array( 'type' => 'connection', 'message' => 'connected to', 'user' => $us, 'subject' => $id
);
Any ideas?