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


PHP MongoDB::listCollections方法代码示例

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


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

示例1: clean

 /**
  * Removes all the collections from the mongo database.
  * Hopefully this is only ever called on the scriptureforge_test database.
  */
 public function clean()
 {
     foreach ($this->db->listCollections() as $collectionInfo) {
         if ($collectionInfo->getName() != 'system.indexes') {
             $collection = $this->db->selectCollection($collectionInfo->getName());
             $collection->drop();
         }
     }
 }
开发者ID:sil-student-projects,项目名称:web-languageforge,代码行数:13,代码来源:MongoTestEnvironment.php

示例2: evaluate

 /**
  * Evaluates the constraint for parameter $other. Returns TRUE if the
  * constraint is met, FALSE otherwise.
  *
  * @param mixed $other Value or object to evaluate.
  * @return bool
  */
 public function evaluate($other)
 {
     $exists = false;
     $collections = $this->db->listCollections();
     $collectionNames = array();
     foreach ($collections as $collection) {
         $collectionNames[] = $collection->getName();
     }
     return !\in_array($other, $collectionNames);
 }
开发者ID:rickyrobinett,项目名称:morph,代码行数:17,代码来源:CollectionDoesNotExist.php

示例3: testListCollections

 public function testListCollections()
 {
     $ns = $this->object->selectCollection('system.namespaces');
     for ($i = 0; $i < 10; $i++) {
         $c = $this->object->selectCollection("x{$i}");
         $c->insert(array("foo" => "bar"));
     }
     $list = $this->object->listCollections();
     for ($i = 0; $i < 10; $i++) {
         $this->assertTrue($list[$i] instanceof MongoCollection);
         if (!preg_match("/5\\.1\\../", phpversion())) {
             $this->assertTrue(in_array("phpunit.x{$i}", $list));
         }
     }
 }
开发者ID:kph11,项目名称:mongo-php-driver,代码行数:15,代码来源:MongoDBTest.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: getTableList

 /**
  * @return array
  */
 public function getTableList()
 {
     $collections = $this->dbcon->listCollections();
     $output = array();
     foreach ($collections as $coll) {
         $output[] = $coll->getName();
     }
     return $output;
 }
开发者ID:vallejos,项目名称:samples,代码行数:12,代码来源:TeraWurflDatabase_MongoDB.php

示例6: listCollections

 /**
  * Gets a list of database collections
  * @return array
  */
 public function listCollections()
 {
     $collections = array();
     $MongoCollectionObjects = $this->mongo->listCollections();
     foreach ($MongoCollectionObjects as $collection) {
         $collection = substr(strstr((string) $collection, '.'), 1);
         $collections[$collection] = $this->mongo->selectCollection($collection)->count();
     }
     ksort($collections);
     return $collections;
 }
开发者ID:doganomer,项目名称:RidderFinal,代码行数:15,代码来源:model.php

示例7: listCollections

 /**
  * List collections in a DB
  *
  * @param MongoDB $db DB
  * @return array<MongoCollection>
  */
 static function listCollections(MongoDB $db)
 {
     $server = MServer::currentServer();
     $names = array();
     $query = $db->execute("function (){ return db.getCollectionNames(); }", array());
     if ($query["ok"]) {
         $names = $query["retval"];
     } else {
         $colls = $db->listCollections(true);
         foreach ($colls as $coll) {
             $names[] = $coll->getName();
         }
     }
     $ret = array();
     foreach ($names as $name) {
         if ($server->shouldHideCollection($name)) {
             continue;
         }
         if (preg_match("/^system\\./", $name)) {
             continue;
         }
         $ret[] = $name;
     }
     sort($ret);
     //system collections
     if (!$server->uiHideSystemCollections()) {
         foreach ($names as $name) {
             if ($server->shouldHideCollection($name)) {
                 continue;
             }
             if (preg_match("/^system\\./", $name)) {
                 $ret[] = $name;
             }
         }
     }
     $collections = array();
     foreach ($ret as $v) {
         if ($v === "") {
             //older MongoDB version (maybe before 1.7) allow empty collection name
             continue;
         }
         $collections[] = $db->selectCollection($v);
     }
     return $collections;
 }
开发者ID:Briareos,项目名称:rockmongo,代码行数:51,代码来源:MDb.php

示例8: listCollections

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

示例9: listCollections

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

示例10: listCollections

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

示例11: clean

 /**
  * Removes all the collections from the mongo database.
  * Hopefully this is only ever called on the scriptureforge_test database.
  */
 public function clean()
 {
     foreach ($this->db->listCollections() as $collection) {
         $collection->drop();
     }
 }
开发者ID:bbriggs,项目名称:web-languageforge,代码行数:10,代码来源:MongoTestEnvironment.php

示例12: listTables

 /**
  * Returns a list of the collections in the database.
  *
  * @return array
  */
 public function listTables()
 {
     return $this->_db->listCollections();
 }
开发者ID:evaneos,项目名称:berthe,代码行数:9,代码来源:MongoDbAdapter.php


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