remove() method without any argument removes all documents inside the collection.
$this->db->$collection->remove();
But how to remove all documents with safe mode?
What should be the first argument of remove?
passing array(‘safe’ => true) as first argument doesn’t delete all document because it’s treated like a filter with key ‘safe’.
$this->db->$collection->remove(array('safe' => true));
You need to pass that as second parameter in the remove call :
http://php.net/manual/en/mongocollection.remove.php