当前位置: 首页>>代码示例>>PHP>>正文


PHP MongoCollection::validate方法代码示例

本文整理汇总了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');
    }
开发者ID:neurodrone,项目名称:mongo-php-driver,代码行数:10,代码来源:MongoCollectionTest.php

示例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']);
 }
开发者ID:salathe,项目名称:mongo-php-driver,代码行数:11,代码来源:MongoCollectionTest.php

示例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;
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:21,代码来源:Collection.php

示例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);
 }
开发者ID:pmnyaga,项目名称:mongodb,代码行数:11,代码来源:Collection.php

示例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;
 }
开发者ID:hybr,项目名称:jpm,代码行数:11,代码来源:LoggableMongoCollection.php


注:本文中的MongoCollection::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。