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


PHP Mongo::drop方法代码示例

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


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

示例1: 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((object)array('name' => 'phpunit.z'));
        $this->assertNotNull($obj);

        $c = $this->object->createCollection('zz', true, 100);
        $obj = $ns->findOne((object)array('name' => 'phpunit.zz'));
        $this->assertNotNull($obj);

        for($i=0;$i<100;$i++) {
            $c->insert((object)array('x' => $i));
        }
        $this->assertLessThan(100, $c->count());

        $c = $this->object->createCollection('zzz', true, 1000, 5);
        $obj = $ns->findOne((object)array('name' => 'phpunit.zzz'));
        $this->assertNotNull($obj);

        for($i=0;$i<10;$i++) {
            $c->insert((object)array('x' => $i));
        }
        $this->assertEquals(5, $c->count());
    }
开发者ID:neurodrone,项目名称:mongo-php-driver,代码行数:28,代码来源:MongoObjDBTest.php

示例2: testEnsureIndex

 public function testEnsureIndex()
 {
     $this->object->ensureIndex('foo');
     $idx = $this->object->db->selectCollection('system.indexes');
     $index = $idx->findOne((object) array('name' => 'foo_1'));
     $this->assertNotNull($index);
     $this->assertEquals($index['key']['foo'], 1);
     $this->assertEquals($index['name'], 'foo_1');
     // get rid of indexes
     $this->object->drop();
     $this->object->ensureIndex((object) array('bar' => -1));
     $index = $idx->findOne((object) array('name' => 'bar_-1'));
     $this->assertNotNull($index);
     $this->assertEquals($index['key']['bar'], -1);
     $this->assertEquals($index['ns'], 'phpunit.c');
 }
开发者ID:redmeadowman,项目名称:mongo-php-driver,代码行数:16,代码来源:MongoObjectsTest.php

示例3: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 public function setUp()
 {
     $m = new Mongo();
     $this->object = $m->selectCollection('foo', 'bar');
     $this->object->drop();
 }
开发者ID:rjonker,项目名称:mongo-php-driver,代码行数:12,代码来源:CmdSymbolTest.php

示例4: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 public function setUp()
 {
     $this->object = $this->sharedFixture->selectCollection('foo', 'bar');
     $this->object->drop();
 }
开发者ID:petewarden,项目名称:mongo-php-driver,代码行数:11,代码来源:CmdSymbolTest.php


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