mysql_xdevapi\Collection
PHP Manual

Collection::removeOne

(No version information available, might only be in Git)

Collection::removeOneRemove one collection document

说明

public mysql_xdevapi\Result mysql_xdevapi\Collection::removeOne ( string $id )

Remove one document from the collection with the correspending ID. This is a shortcut for Collection.remove("_id = :id").bind("id", id).execute().

参数

id

The ID of the collection document to remove.

返回值

A Result object that can be used to query the number of affected items or the number warnings generated by the operation.

范例

Example #1 mysql_xdevapi\Collection::removeOne() example

<?php
// Assuming $coll is a valid collection object

$res $coll->removeOne('00005ad66abf0001000400000003');

if( 
$res->getAffectedItemsCount() == ) {
    print(
'The document with ID 00005ad66abf0001000400000003 seems to not exists, nothing was removed');
}
?>

mysql_xdevapi\Collection
PHP Manual