MongoCollection::drop

(PECL mongo >=0.9.0)

MongoCollection::drop删除该集合

说明

public MongoCollection::drop ( void ) : array

删除该集合,以及它的索引。

参数

此函数没有参数。

返回值

返回数据库的响应。

范例

Example #1 MongoCollection::drop() 例子

这个例子演示了如何删除一个集合,并且得到想要的回应。

<?php

$collection 
$mongo->my_db->articles;
$response $collection->drop();
print_r($response);

?>

以上例程的输出类似于:

Array
(
    [nIndexesWas] => 1
    [msg] => all indexes deleted for collection
    [ns] => my_db.articles
    [ok] => 1
)