bobthecow/genghis

error when updating document

Closed this issue · 5 comments

I can't update any documents .
On the request
$this->collection->update($query, $doc, self::safe())
$doc is stdclassObject but php plugin need an Array
$this->collection->update($query, (array)$doc, self::safe()) resolve it.

Genghis Version 2.3.11
PHP 5.5.9-1ubuntu4.4
Apache/2.4.7
mongod db version v2.6.4
PECL : mongo 1.5.1 stable

If you want more informations about my configuration or options tell me.

I just tested with this setup and it worked perfectly:

>>> PHP_VERSION
=> "5.5.15"
>>> GENGHIS_VERSION
=> "2.3.11"
>>> Mongo::VERSION
=> "1.5.4"

The second argument to MongoCollection::update should take either an array of fields or an object. Maybe the driver v1.5.1 had an issue that they fixed by 1.5.4?

The signature for MongoCollection::update in v1.5.4 is this:

public function update($old_array_of_fields_OR_object, $new_array_of_fields_OR_object, array $options = ?)

Possibly PHP-1084, which was fixed with mongodb/mongo-php-driver#685 in 1.5.2.

Yep. That looks about right. Thanks @jmikola

@Nours312 Update to a newer version of the mongo driver and you're set!