<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Remove a file and its chunks from the database</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongogridfs.construct.html">MongoGridFS::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongogridfs.drop.html">MongoGridFS::drop</a></div> <div class="up"><a href="class.mongogridfs.html">MongoGridFS</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mongogridfs.delete" class="refentry"> <div class="refnamediv"> <h1 class="refname">MongoGridFS::delete</h1> <p class="verinfo">(PECL mongo >=1.0.8)</p><p class="refpurpose"><span class="refname">MongoGridFS::delete</span> — <span class="dc-title">Remove a file and its chunks from the database</span></p> </div> <div class="refsect1 description" id="refsect1-mongogridfs.delete-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><span class="type bool|array">bool|array</span></span> <span class="methodname"><strong>MongoGridFS::delete</strong></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$id</code></span> )</div> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> <span class="methodname"><strong>MongoGridFS::delete()</strong></span> is a convenience method for calling <span class="methodname"><a href="mongogridfs.remove.html" class="methodname">MongoGridFS::remove()</a></span> with specific <code class="parameter">criteria</code> and default <code class="parameter">options</code> parameters. </p> </p></blockquote> </div> <div class="refsect1 parameters" id="refsect1-mongogridfs.delete-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">id</code> </dt> <dd> <p class="para"> <em>_id</em> of the file to remove. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-mongogridfs.delete-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an array containing the status of the removal (with respect to the <em>files</em> collection) if a <a href="mongo.writeconcerns.html" class="link">write concern</a> is applied. Otherwise, returns <strong><code>TRUE</code></strong>. </p> <p class="para"> Fields in the status array are described in the documentation for <span class="function"><a href="mongocollection.insert.html" class="function">MongoCollection::insert()</a></span>. </p> </div> <div class="refsect1 errors" id="refsect1-mongogridfs.delete-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para">Throws <a href="class.mongocursorexception.html" class="classname">MongoCursorException</a> if the <em>"w"</em> option is set and the write fails.</p><p class="para">Throws <a href="class.mongocursortimeoutexception.html" class="classname">MongoCursorTimeoutException</a> if the <em>"w"</em> option is set to a value greater than one and the operation takes longer than <var class="varname"><var class="varname">MongoCursor::$timeout</var></var> milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in <var class="varname"><var class="varname">MongoCollection::$wtimeout</var></var> is milliseconds.</p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongogridfs.construct.html">MongoGridFS::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongogridfs.drop.html">MongoGridFS::drop</a></div> <div class="up"><a href="class.mongogridfs.html">MongoGridFS</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>