Php/docs/mongogridfs.delete

来自菜鸟教程
跳转至:导航、​搜索

MongoGridFS::delete

(PECL mongo >=1.0.8)

MongoGridFS::deleteRemove a file and its chunks from the database


说明

public MongoGridFS::delete ( mixed $id ) : bool|array

Note:

MongoGridFS::delete() is a convenience method for calling MongoGridFS::remove() with specific criteria and default options parameters.

参数

id
_id of the file to remove.


返回值

Returns an array containing the status of the removal (with respect to the files collection) if a write concern is applied. Otherwise, returns true.

Fields in the status array are described in the documentation for MongoCollection::insert().


错误/异常

Throws MongoCursorException if the "w" option is set and the write fails.

Throws MongoCursorTimeoutException if the "w" option is set to a value greater than one and the operation takes longer than MongoCursor::$timeout milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in MongoCollection::$wtimeout is milliseconds.