public function remove($criteria = array(), $options = array()) { try { $options = array_merge($options, array('safe' => TRUE)); return parent::remove($criteria, $options); } catch (MongoCursorException $e) { show_error("MongoDB remove failed: {$e->getMessage()}", 500); } }
public function testRemove() { for ($i = 0; $i < 15; $i++) { $this->object->insert((object) array("i" => $i)); } $this->assertEquals($this->object->count(), 15); $this->object->remove(array(), true); $this->assertEquals($this->object->count(), 14); $this->object->remove((object) array()); $this->assertEquals($this->object->count(), 0); for ($i = 0; $i < 15; $i++) { $this->object->insert((object) array("i" => $i)); } $this->assertEquals($this->object->count(), 15); $this->object->remove(); $this->assertEquals($this->object->count(), 0); }
/** * Method called on the destruction of a database session. * * @param integer $id ID that uniquely identifies session in database * @return boolean True for successful delete, false otherwise. * @access private */ public function __destroy($id) { $this->_mongo->remove(array('session_id' => $id), true); return true; }