©
This document uses PHP Chinese website manual Release
(PECL mongo >=1.0.8)
MongoGridFS::delete — Remove a file and its chunks from the database
$id
)Note:
MongoGridFS::delete() is a convenience method for calling MongoGridFS::remove() with specific
criteria
and defaultoptions
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.
[#1] mshallop+php-at-gmail-dot-com [2014-07-24 01:09:02]
Doc doesn't explicitly state what is returned.
Returns an array:
{
n => {integer value} (number of records deleted),
connectionID => { integer value }
err => null or error text/code
ok => 1 or 0
}
Sample output:
{ n : 1, connectionID : 33132, err : null, ok : 1 }