MongoDB
PHP 手册

MongoDB::drop

(PECL mongo >=0.9.0)

MongoDB::dropDrops this database

说明

public array MongoDB::drop ( void )

This drops the database currently being used.

This is identical to running:

<?php

public function drop() {
    
$this->command(array("dropDatabase" => 1));
}

?>

参数

此函数没有参数。

返回值

Returns the database response.

范例

Example #1 MongoDB::drop() example

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

<?php

$db 
$mongo->foo;
$response $db->drop();
print_r($response);

?>

以上例程的输出类似于:

Array
(
    [dropped] => foo.$cmd
    [ok] => 1
)

MongoDB
PHP 手册