php8.5
Home/ Manual/ mysql_xdevapi / collectionmodify/ CollectionModify::unset

CollectionModify::unset

PHP function Edit on GitHub ✎

Unset the value of document fields

Description

mysql_xdevapi\CollectionModify::unset(array $fields): mysql_xdevapi\CollectionModify

Removes attributes from documents in a collection.

Parameters

fields

The attributes to remove from documents in a collection.

Return Values

CollectionModify object that can be used for further processing.

Examples

mysql_xdevapi\CollectionModify::unset() example

php
<?php

$res = $coll->modify('job like :job_name')->unset(["age", "name"])->bind(['job_name' => 'Plumber'])->execute();

?>

Source: reference/mysql_xdevapi/mysql_xdevapi/collectionmodify/unset.xml · from the official PHP manual (php/doc-en)