本文整理汇总了PHP中Mongo::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Mongo::remove方法的具体用法?PHP Mongo::remove怎么用?PHP Mongo::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mongo
的用法示例。
在下文中一共展示了Mongo::remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
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);
}
}
示例2: testRemove
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);
}
示例3: __destroy
/**
* 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;
}