當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。