MongoCollection::drop

(PECL mongo >=0.9.0)
Drops this collection
public array MongoCollection::drop ( void )

Drops this collection and deletes its indices.

Returns:

Returns the database response.

Examples:
MongoCollection::drop() example

This example demonstrates how to drop a collection and the response to expect.

<?php

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

?>

The above example will output something similar to:

Array
(
    [nIndexesWas] => 1
    [msg] => all indexes deleted for collection
    [ns] => my_db.articles
    [ok] => 1
)
doc_php
2016-02-24 16:20:36
Comments
Leave a Comment

Please login to continue.