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


PHP MongoDB::dropCollection方法代码示例

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


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

示例1: tearDown

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

示例2: testDropCollection2

    public function testDropCollection2() {
      $ns = $this->object->selectCollection('system.namespaces');

      $this->object->x->insert(array("foo"=>"bar"));
      $this->assertNotNull($ns->findOne(array('name'=> new MongoRegex('/.x$/'))));

      $this->object->dropCollection('x');
      $this->assertEquals($ns->findOne(array('name'=> new MongoRegex('/.x$/'))), null);

      $this->object->x->insert(array("foo"=>"bar"));
      $this->assertNotNull($ns->findOne(array('name'=> new MongoRegex('/.x$/'))));

      $this->object->dropCollection($this->object->x);
      $this->assertEquals($ns->findOne(array('name'=> new MongoRegex('/.x$/'))), null);

      $mem = memory_get_usage(true);
      for ($i=0; $i<1000; $i++) {
        $this->object->dropCollection("form");
      }
      $this->assertEquals($mem, memory_get_usage(true));

      $mem = memory_get_usage(true);
      for ($i=0; $i<1000; $i++) {
        $this->object->dropCollection($this->object->form);
      }
      $this->assertEquals($mem, memory_get_usage(true));
    }
开发者ID:neurodrone,项目名称:mongo-php-driver,代码行数:27,代码来源:MongoDBTest.php

示例3: getTags

 /**
  * Return an array of stored tags
  *
  * @return array array of stored tags (string)
  */
 public function getTags()
 {
     $cmd['mapreduce'] = $this->_options['collection'];
     $cmd['map'] = 'function(){
                             this.t.forEach(
                                 function(z){
                                     emit( z , { count : 1 } );
                                 }
                             );
                         };';
     $cmd['reduce'] = 'function( key , values ){
                             var total = 0;
                             for ( var i=0; i<values.length; i++ )
                                 total += values[i].count;
                             return { count : total };
                         };';
     $cmd['out'] = array('replace' => 'getTagsCollection');
     $res2 = $this->_db->command($cmd);
     $res3 = $this->_db->selectCollection('getTagsCollection')->find();
     $res = array();
     foreach ($res3 as $key => $val) {
         $res[] = $key;
     }
     $this->_db->dropCollection($res2['result']);
     return $res;
 }
开发者ID:TerranetMD,项目名称:zf-cache-backend,代码行数:31,代码来源:Mongo.php

示例4: resetStorage

 /**
  * Delete the database with all documents, it will be recreated on
  * next access.
  *
  * @return void
  */
 public function resetStorage()
 {
     $collectioNames = $this->database->listCollections();
     foreach ($collectioNames as $collectionName) {
         $this->database->dropCollection($collectionName);
     }
 }
开发者ID:hlubek,项目名称:MongoDB-Package,代码行数:13,代码来源:MongoDbBackend.php

示例5: dropCollection

 /**
  * Wrapper method for MongoDB::dropCollection().
  *
  * @see http://php.net/manual/en/mongodb.dropcollection.php
  * @param string $coll
  * @return array
  */
 public function dropCollection($coll)
 {
     return $this->mongoDB->dropCollection($coll);
 }
开发者ID:alcaeus,项目名称:mongodb,代码行数:11,代码来源:Database.php

示例6: doRemoveCollection

 /** drop collection **/
 public function doRemoveCollection()
 {
     $this->db = x("db");
     $this->collection = xn("collection");
     $db = new MongoDB($this->_mongo, $this->db);
     $db->dropCollection($this->collection);
     $this->display();
 }
开发者ID:tolsasha,项目名称:Forum_PO,代码行数:9,代码来源:collection.php

示例7: _call

 protected function _call($command, array $arguments = array(), array $values = NULL)
 {
     $this->_connected or $this->connect();
     extract($arguments);
     $_bm_name = isset($collection_name) ? $collection_name . '.' . $command : $command;
     if (isset($collection_name)) {
         $c = $this->_db->selectCollection($collection_name);
     }
     switch ($command) {
         case 'ensure_index':
             $r = $c->ensureIndex($keys, $options);
             break;
         case 'create_collection':
             $r = $this->_db->createCollection($name, $capped, $size, $max);
             break;
         case 'drop_collection':
             $r = $this->_db->dropCollection($name);
             break;
         case 'command':
             $r = $this->_db->command($values);
             break;
         case 'execute':
             $r = $this->_db->execute($code, $args);
             break;
         case 'batch_insert':
             $r = $c->batchInsert($values);
             break;
         case 'count':
             $r = $c->count($query);
             break;
         case 'find_one':
             $r = $c->findOne($query, $fields);
             break;
         case 'find':
             $r = $c->find($query, $fields);
             break;
         case 'group':
             $r = $c->group($keys, $initial, $reduce, $condition);
             break;
         case 'update':
             $r = $c->update($criteria, $values, $options);
             break;
         case 'insert':
             $r = $c->insert($values, $options);
             break;
         case 'remove':
             $r = $c->remove($criteria, $options);
             break;
         case 'save':
             $r = $c->save($values, $options);
             break;
         case 'get_file':
             $r = $this->gridFS()->findOne($criteria);
             break;
         case 'get_files':
             $r = $this->gridFS()->find($query, $fields);
             break;
         case 'set_file_bytes':
             $r = $this->gridFS()->storeBytes($bytes, $extra, $options);
             break;
         case 'set_file':
             $r = $this->gridFS()->storeFile($filename, $extra, $options);
             break;
         case 'remove_file':
             $r = $this->gridFS()->remove($criteria, $options);
             break;
     }
     if (isset($_bm)) {
         Profiler::stop($_bm);
     }
     return $r;
 }
开发者ID:execrot,项目名称:mongostar,代码行数:72,代码来源:Connection.php


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