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


PHP Client::getDatabase方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     // select database
     $this->database = $client->getDatabase('test');
 }
开发者ID:sokil,项目名称:php-mongo,代码行数:7,代码来源:DatabaseTest.php

示例2: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     // select database
     $this->database = $client->getDatabase('test');
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:7,代码来源:DatabaseTest.php

示例3: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     // select database
     $this->database = $client->getDatabase('test');
     $this->queue = $this->database->getQueue('queue_channel');
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:8,代码来源:QueueTest.php

示例4: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     // select database
     $database = $client->getDatabase('test');
     // select collection
     $this->collection = $database->getCollection('phpmongo_test_collection');
 }
开发者ID:Branik,项目名称:php-mongo,代码行数:9,代码来源:ExpressionTest.php

示例5: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     // select database
     $database = $client->getDatabase('test');
     // select collection
     $this->collection = $database->getCollection('phpmongo_test_collection');
 }
开发者ID:sokil,项目名称:php-mongo,代码行数:9,代码来源:ExpressionTest.php

示例6: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     if (version_compare($client->getDbVersion(), '2.6.0', '<')) {
         $this->markTestSkipped('Current primary does not have a Write API support.');
     }
     // select database
     $database = $client->getDatabase('test');
     $this->collection = $database->getCollection('phpmongo_test_collection');
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:11,代码来源:BatchTest.php

示例7: setUp

 public function setUp()
 {
     $client = new Client();
     $this->cache = $client->getDatabase('test')->getCache('cache_namespace')->init();
 }
开发者ID:Horrower,项目名称:php-mongo,代码行数:5,代码来源:CacheTest.php

示例8: testStoreDocumentInPool_DocumentAlreadyStored

 public function testStoreDocumentInPool_DocumentAlreadyStored()
 {
     /**
      * Store document to pool
      */
     $this->assertTrue($this->collection->isDocumentPoolEmpty());
     $document = $this->collection->createDocument(array('param' => 'value'))->save();
     $this->assertFalse($this->collection->isDocumentPoolEmpty());
     /**
      * Modify document in another thread
      */
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     $client->getDatabase($document->getCollection()->getDatabase()->getName())->getCollection($document->getCollection()->getName())->find()->findOne()->set('param', 'updatedValue')->save();
     // here oroginal document must be in unconsisted state
     $this->assertEquals('value', $document->get('param'));
     // overload document in pool with new data
     $this->collection->find()->findOne();
     $this->assertEquals('updatedValue', $document->get('param'));
 }
开发者ID:sokil,项目名称:php-mongo,代码行数:19,代码来源:CollectionTest.php

示例9: setUp

 public function setUp()
 {
     $client = new Client();
     $this->database = $client->getDatabase('test');
     $this->gridFs = $this->database->getGridFs('images');
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:6,代码来源:GridFsTest.php

示例10: setUp

 public function setUp()
 {
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     $this->database = $client->getDatabase('test');
     $this->gridFs = $this->database->getGridFs('images');
 }
开发者ID:sokil,项目名称:php-mongo,代码行数:6,代码来源:GridFsTest.php

示例11: testGetDatabase_NameNotSpecified_DefaultNameNotSpecified

 /**
  * @expectedException \Sokil\Mongo\Exception
  * @expectedExceptionMessage Database not selected
  */
 public function testGetDatabase_NameNotSpecified_DefaultNameNotSpecified()
 {
     $client = new Client('mongodb://127.0.0.1/');
     $this->assertEquals('some_name', $client->getDatabase()->getName());
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:9,代码来源:ClientTest.php

示例12: setUp

 public function setUp()
 {
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     $database = $client->getDatabase('test');
     $this->collection = $database->getCollection('phpmongo_test_collection')->delete();
 }
开发者ID:sokil,项目名称:php-mongo,代码行数:6,代码来源:DocumentGeoTest.php

示例13: setUp

 public function setUp()
 {
     $client = new Client();
     $database = $client->getDatabase('test');
     $this->collection = $database->getCollection('phpmongo_test_collection')->delete();
 }
开发者ID:Branik,项目名称:php-mongo,代码行数:6,代码来源:DocumentTest.php

示例14: setUp

 public function setUp()
 {
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     $this->cache = $client->getDatabase('test')->getCache('cache_namespace')->init();
 }
开发者ID:sokil,项目名称:php-mongo,代码行数:5,代码来源:CacheTest.php


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