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


PHP MongoCollection::drop方法代码示例

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


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

示例1: setUp

 /**
  * @access protected
  */
 protected function setUp()
 {
     $m = new Mongo();
     $db = new MongoDB($m, "phpunit");
     $this->object = $db->selectCollection('c');
     $this->object->drop();
 }
开发者ID:redmeadowman,项目名称:mongo-php-driver,代码行数:10,代码来源:MongoCollectionTest2.php

示例2: initialize

 /**
  * @test
  */
 public function initialize()
 {
     $this->collection->drop();
     $author = new Author('kirk');
     $user = new Netizen($author);
     $user->setProfile(new \Trismegiste\SocialBundle\Security\Profile());
     $this->repository->persist($user);
     $source = new SmallTalk($author);
     $this->repository->batchPersist([$source, $source, $source]);
     $this->assertCount(4, $this->collection->find());
     return (string) $user->getId();
 }
开发者ID:xtrasmal,项目名称:iinano,代码行数:15,代码来源:PublishingCounterTest.php

示例3: clear

 /**
  * {@inheritdoc}
  */
 public function clear($key = null)
 {
     if (!$key) {
         $this->collection->drop();
         return true;
     }
     if ($this->collection instanceof \MongoDB\Collection) {
         $this->collection->deleteMany(['_id' => new \MongoDB\BSON\Regex("^" . preg_quote(self::mapKey($key)), '')]);
     } else {
         $this->collection->remove(['_id' => new \MongoRegex("^" . preg_quote(self::mapKey($key)))], ['multiple' => true]);
     }
     return true;
 }
开发者ID:Fiskie,项目名称:mongostash,代码行数:16,代码来源:MongoDB.php

示例4: testEnsureIndex

    public function testEnsureIndex() {
      $this->object->ensureIndex('foo');

      $idx = $this->object->db->selectCollection('system.indexes');
      $index = $idx->findOne(array('name' => 'foo_1'));

      $this->assertNotNull($index);
      $this->assertEquals($index['key']['foo'], 1);
      $this->assertEquals($index['name'], 'foo_1');

      $this->object->ensureIndex("");
      $index = $idx->findOne(array('name' => '_1'));
      $this->assertEquals(null, $index);

      // get rid of indexes
      $this->object->drop();

      $this->object->ensureIndex(null);
      $index = $idx->findOne(array('name' => '_1'));
      $this->assertEquals(null, $index);

      $this->object->ensureIndex(array('bar' => -1));
      $index = $idx->findOne(array('name' => 'bar_-1'));
      $this->assertNotNull($index);
      $this->assertEquals($index['key']['bar'], -1);
      $this->assertEquals($index['ns'], 'phpunit.c');
    }
开发者ID:neurodrone,项目名称:mongo-php-driver,代码行数:27,代码来源:MongoCollectionTest.php

示例5: drop_demo

/**
 * Demonstrate logging on collection.drop().
 *
 * @param \MongoCollection $collection
 *   The demo collection.
 * @param \Psr\Log\LoggerInterface $logger
 *   The logger instance.
 */
function drop_demo(MongoCollection $collection, LoggerInterface $logger)
{
    $logger->debug("Dropping {$collection}");
    $logger instanceof TimingLoggerInterface && $logger->startLap();
    $collection->drop();
    $logger->debug('');
}
开发者ID:fgm,项目名称:mongodb_logger,代码行数:15,代码来源:loguser.php

示例6: purge

 /**
  * Purges the cache deleting all items within it.
  *
  * @return boolean True on success. False otherwise.
  */
 public function purge()
 {
     if ($this->isready) {
         $this->collection->drop();
         $this->collection = $this->database->selectCollection($this->definitionhash);
     }
     return true;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:13,代码来源:lib.php

示例7: initialize

 /**
  * @test
  */
 public function initialize()
 {
     $this->collection->drop();
     $author = [];
     foreach (['kirk', 'spock', 'mccoy'] as $nick) {
         $author[] = new Author($nick);
     }
     $source = new SmallTalk($author[0]);
     $this->repository->persist($source);
     $rep[0] = new Repeat($author[1]);
     $rep[0]->setEmbedded($source);
     $this->repository->persist($rep[0]);
     $rep[1] = new Repeat($author[2]);
     $rep[1]->setEmbedded($rep[0]);
     $this->repository->persist($rep[1]);
     $this->assertCount(3, $this->collection->find());
 }
开发者ID:xtrasmal,项目名称:iinano,代码行数:20,代码来源:RepeatCounterTest.php

示例8: dropResultSet

 /**
  * Drop the collection created by MapReduce
  * @return Array
  */
 public function dropResultSet()
 {
     if (!isset($this->collection)) {
         $this->collection = new MongoCollection($this->mongoDB, $this->_response["result"]);
     }
     $db_response = $this->collection->drop();
     $this->collection = NULL;
     return $db_response;
 }
开发者ID:rjdjohnston,项目名称:MongoDB-MapReduce-PHP,代码行数:13,代码来源:MongoMapReduceResponse.php

示例9: delete

 /**
  * Delete collection
  * 
  * @return \Sokil\Mongo\Collection
  * @throws \Sokil\Mongo\Exception
  */
 public function delete()
 {
     $status = $this->_mongoCollection->drop();
     if ($status['ok'] != 1) {
         // check if collection exists
         if ('ns not found' !== $status['errmsg']) {
             // collection exist
             throw new Exception('Error deleting collection ' . $this->getName() . ': ' . $status['errmsg']);
         }
     }
     return $this;
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:18,代码来源:Collection.php

示例10: initDbWithOnePublishingWithReportedComment

 protected function initDbWithOnePublishingWithReportedComment()
 {
     $author = [];
     foreach (['kirk', 'spock', 'mccoy'] as $nick) {
         $author[] = new Author($nick);
     }
     $doc = new SmallTalk($author[0]);
     $comm = new Commentary($author[1]);
     $comm->report($author[2]);
     $comm->report($author[0]);
     $doc->attachCommentary($comm);
     $this->coll->drop();
     $this->repo->persist($doc);
 }
开发者ID:xtrasmal,项目名称:iinano,代码行数:14,代码来源:AbuseReportTest.php

示例11: testreg

function testreg()
{
    // connect
    $m = new MongoClient();
    // select a database
    $db = $m->selectDB('trend');
    // select a collection (analogous to a relational database's table)
    $colnames = ['housesale', 'aptsale', 'flatsale', 'houserent', 'aptrent', 'flatrent'];
    foreach ($colnames as $colname) {
        $col2name = $colname . "_reg";
        $col2 = new MongoCollection($db, $col2name);
        // Let's remove all first
        $col2->drop([]);
        // add agg information
        mkreg($db, $colname);
    }
}
开发者ID:hunkim,项目名称:kproperty,代码行数:17,代码来源:mkregions.php

示例12: drop

 /**
  * Drops the files and chunks collections
  *
  * @return array - The database response.
  */
 public function drop()
 {
     $this->chunks->drop();
     parent::drop();
 }
开发者ID:Wynncraft,项目名称:mongofill,代码行数:10,代码来源:MongoGridFS.php

示例13: truncate

 /**
  * Run a truncate statement on the table.
  */
 public function truncate()
 {
     $result = $this->collection->drop();
     return 1 == (int) $result->ok;
 }
开发者ID:mean-cj,项目名称:laravel-mongodb,代码行数:8,代码来源:Builder.php

示例14: tearDown

 /**
  * Tear-down operations performed after each test method
  *
  * @return void
  */
 public function tearDown()
 {
     if ($this->mongoCollection) {
         $this->mongoCollection->drop();
     }
 }
开发者ID:benivaldo,项目名称:zf2-na-pratica,代码行数:11,代码来源:MongoDBTest.php

示例15: tearDown

 protected function tearDown()
 {
     if (!is_null($this->userCollection)) {
         $this->userCollection->drop();
     }
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:6,代码来源:MongoDbTest.php


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