本文整理汇总了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();
}
}
示例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));
}
示例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;
}
示例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);
}
}
示例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);
}
示例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();
}
示例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;
}