I try to delete document in mongodb using php, I it fails and I get a waring:
Warning: MongoCollection::remove() expects parameter 2 to be boolean, array given
$mongo = new Mongo();
$db = $mongo->test;
$collection = $db->subscribers;
$collection->remove(array( 'LISTID' => 49));
Could you please tell me what causes an error? I phpinfo() shows:
mongo
MongoDB Support enabled
Version 1.0.4+
Directive Local Value Master Value
mongo.allow_persistent On On
mongo.auto_reconnect On On
mongo.chunk_size 262144 262144
mongo.cmd $ $
mongo.default_host localhost localhost
mongo.default_port 27017 27017
mongo.utf8 1 1
It's strange, the documentation say the function looks like:
public mixed MongoCollection::remove ( array $criteria [, array $options = array() ] )
You need to specify the remove options:
$collection->remove(array('type' => 94), array("justOne" => true));
for more info, see the online manual
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With