本文整理汇总了PHP中MongoCollection::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoCollection::validate方法的具体用法?PHP MongoCollection::validate怎么用?PHP MongoCollection::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoCollection
的用法示例。
在下文中一共展示了MongoCollection::validate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testValidate
public function testValidate() {
$v = $this->object->validate();
$this->assertEquals((bool)$v['ok'], false);
$this->assertEquals($v['errmsg'], 'ns not found');
$this->object->insert(array('a' => 'foo'));
$v = $this->object->validate();
$this->assertEquals((bool)$v['ok'], true);
$this->assertEquals($v['ns'], 'phpunit.c');
}
示例2: testValidate
public function testValidate()
{
$v = $this->object->validate();
$this->assertEquals($v['ok'], 0);
$this->assertEquals($v['errmsg'], 'ns not found');
$this->object->insert(array('a' => 'foo'));
$v = $this->object->validate();
$this->assertEquals($v['ok'], 1);
$this->assertEquals($v['ns'], 'phpunit.c');
$this->assertNotNull($v['result']);
}
示例3: validate
/**
* Validates a collection. The method scans a collection’s data structures
* for correctness and returns a single document that describes the
* relationship between the logical collection and the physical
* representation of the data.
*
* @link http://docs.mongodb.org/manual/reference/method/db.collection.validate/
* @param bool $full Specify true to enable a full validation and to return
* full statistics. MongoDB disables full validation by default because it
* is a potentially resource-intensive operation.
* @return array
* @throws Exception
*/
public function validate($full = false)
{
$response = $this->_mongoCollection->validate($full);
if (!$response || $response['ok'] != 1) {
throw new Exception($response['errmsg']);
}
return $response;
}
示例4: validate
/**
* Wrapper method for MongoCollection::validate().
*
* @see http://php.net/manual/en/mongocollection.validate.php
* @param string $scanData
* @return array
*/
public function validate($scanData = false)
{
return $this->mongoCollection->validate($scanData);
}
示例5: validate
/**
* validate.
*/
public function validate($scanData = false)
{
$this->time->start();
$return = parent::validate($scanData);
$time = $this->time->stop();
$this->log(array('type' => 'validate', 'scanData' => $scanData, 'time' => $time));
return $return;
}