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


PHP MongoDB::drop方法代码示例

本文整理汇总了PHP中MongoDB::drop方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoDB::drop方法的具体用法?PHP MongoDB::drop怎么用?PHP MongoDB::drop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoDB的用法示例。


在下文中一共展示了MongoDB::drop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 public function tearDown()
 {
     if ($this->db instanceof \MongoDB) {
         $this->db->drop();
     }
     parent::tearDown();
 }
开发者ID:alapini,项目名称:apigility-3hr-tutorial,代码行数:7,代码来源:AuthControllerWithMongoAdapterTest.php

示例2: tearDown

 public function tearDown()
 {
     $this->database->dropCollection('testCollection');
     $this->database->drop();
     if (Mongo::getInstance()) {
         Mongo::getInstance()->destroy();
     }
 }
开发者ID:komita1981,项目名称:DbMockLibrary,代码行数:8,代码来源:DeleteTest.php

示例3: testCreateCollection

    public function testCreateCollection() {
        $ns = $this->object->selectCollection('system.namespaces');
        $this->object->drop('z');
        $this->object->drop('zz');
        $this->object->drop('zzz');

        $this->object->createCollection('z');
        $obj = $ns->findOne(array('name' => 'phpunit.z'));
        $this->assertNotNull($obj);

        // even though we're only setting this to 100, it allocates 1 extent,
        // so we can fit 4096, not 100, bytes of data in the collection.
        $c = $this->object->createCollection('zz', true, 100);
        $obj = $ns->findOne(array('name' => 'phpunit.zz'));
        $this->assertNotNull($obj);

        for($i=0;$i<100;$i++) {
            $c->insert(array('x' => $i));
        }
        $this->assertLessThan(100, $c->count());

        $c = $this->object->createCollection('zzz', true, 1000, 5);
        $obj = $ns->findOne(array('name' => 'phpunit.zzz'));
        $this->assertNotNull($obj);

        for($i=0;$i<10;$i++) {
            $c->insert(array('x' => $i));
        }
        $this->assertEquals(5, $c->count());
    }
开发者ID:neurodrone,项目名称:mongo-php-driver,代码行数:30,代码来源:MongoDBTest.php

示例4: drop

 /**
  * Drop the database
  *
  * @return boolean
  */
 public function drop()
 {
     $ok = $this->db->drop();
     if (1 == (int) $ok['ok']) {
         return true;
     }
     return false;
 }
开发者ID:hexcores,项目名称:mongo-lite,代码行数:13,代码来源:Connection.php

示例5: dropDb

 /**
  * Drops a database
  */
 public function dropDb()
 {
     $this->mongo->drop();
     return;
     if (!isset($this->_db)) {
         $this->_db = $this->_mongo();
     }
     $this->_db->dropDB($this->mongo);
 }
开发者ID:doganomer,项目名称:RidderFinal,代码行数:12,代码来源:model.php

示例6: flush

 /**
  * {@inheritdoc}
  */
 public function flush($all = false)
 {
     if (true === $all) {
         $res = $this->db->drop();
         return (bool) $res['ok'];
     }
     // $res = $this->collection->drop();
     $regex = new \MongoRegex('/^' . $this->mapKey('') . '/');
     $res = $this->collection->remove(array('key' => $regex));
     return (bool) $res['ok'];
 }
开发者ID:MacFJA,项目名称:apix-cache,代码行数:14,代码来源:Mongo.php

示例7: drop_db

 /**
  * Drop database
  *
  * @param string $database
  * @return bool|array
  */
 public function drop_db($database)
 {
     if (!empty($database)) {
         try {
             return $this->_database->drop();
         } catch (\Exception $e) {
             $this->_last_error = $e;
         }
     }
     return false;
 }
开发者ID:ravikathaitarm01,项目名称:fluenz1,代码行数:17,代码来源:MongoDB.php

示例8: drop

 /**
  * Wrapper method for MongoDB::drop().
  *
  * This method will dispatch preDropDatabase and postDropDatabase events.
  *
  * @see http://php.net/manual/en/mongodb.drop.php
  * @return array
  */
 public function drop()
 {
     if ($this->eventManager->hasListeners(Events::preDropDatabase)) {
         $this->eventManager->dispatchEvent(Events::preDropDatabase, new EventArgs($this));
     }
     $result = $this->mongoDB->drop();
     if ($this->eventManager->hasListeners(Events::postDropDatabase)) {
         $this->eventManager->dispatchEvent(Events::postDropDatabase, new EventArgs($this));
     }
     return $result;
 }
开发者ID:alcaeus,项目名称:mongodb,代码行数:19,代码来源:Database.php

示例9: testCreateCollection

 public function testCreateCollection()
 {
     $ns = $this->object->selectCollection('system.namespaces');
     $this->object->drop('z');
     $this->object->drop('zz');
     $this->object->drop('zzz');
     $this->object->createCollection('z');
     $obj = $ns->findOne(array('name' => 'phpunit.z'));
     $this->assertNotNull($obj);
     $c = $this->object->createCollection('zz', true, 100);
     $obj = $ns->findOne(array('name' => 'phpunit.zz'));
     $this->assertNotNull($obj);
     for ($i = 0; $i < 10; $i++) {
         $c->insert(array('x' => $i));
     }
     $this->assertLessThan(10, $c->count());
     $c = $this->object->createCollection('zzz', true, 1000, 5);
     $obj = $ns->findOne(array('name' => 'phpunit.zzz'));
     $this->assertNotNull($obj);
     for ($i = 0; $i < 10; $i++) {
         $c->insert(array('x' => $i));
     }
     $this->assertEquals(5, $c->count());
 }
开发者ID:redmeadowman,项目名称:mongo-php-driver,代码行数:24,代码来源:MongoDBTest.php

示例10: drop

 /**
  * drop.
  */
 public function drop()
 {
     $this->time->start();
     $return = parent::drop();
     $time = $this->time->stop();
     $this->log(array('type' => 'drop', 'time' => $time));
     return $return;
 }
开发者ID:mongator,项目名称:mongator,代码行数:11,代码来源:LoggableMongoDB.php

示例11: dropDb

 /**
  * Drop the current DB.
  * @since v1.0
  */
 public function dropDb()
 {
     $this->_mongoDb->drop();
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:8,代码来源:EMongoDB.php

示例12: drop

 /**
  *	Intercept native call to re-enable profiler
  *	@return int
  **/
 function drop()
 {
     $out = parent::drop();
     $this->setprofilinglevel(2);
     return $out;
 }
开发者ID:Mumcio,项目名称:bookmark-manager,代码行数:10,代码来源:mongo.php

示例13: tearDown

 /**
  * @return void
  */
 public function tearDown()
 {
     if (isset($this->database)) {
         $this->database->drop();
     }
 }
开发者ID:rickyrobinett,项目名称:morph,代码行数:9,代码来源:TestCase.php

示例14: testDrop

 public function testDrop()
 {
     $r = $this->object->drop();
     $this->assertEquals(true, (bool) $r['ok'], json_encode($r));
 }
开发者ID:kph11,项目名称:mongo-php-driver,代码行数:5,代码来源:MongoDBTest.php

示例15: removeMongoDb

 public function removeMongoDb(\MongoDB $db)
 {
     $db->drop();
 }
开发者ID:johnmicahmiguel,项目名称:yodaphp,代码行数:4,代码来源:Bootstrap.php


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