Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$title is deprecated in /home/www/dev/work/website/lvesu/class/controller/blog/php.php on line 28

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/php.manual.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
PHP - Manual: MongoGridFS::delete - 互联网笔记

略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: MongoGridFS::delete

2025-05-19

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.

add a note add a note

User Contributed Notes 1 note

up
-2
mshallop+php-at-gmail-dot-com
4 years ago
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 }

官方地址:https://www.php.net/manual/en/mongogridfs.delete.php

冷却塔厂家 广告
中文GPT4.0无需注册 广告
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3