(No version information available, might only be in Git)
CollectionModify::arrayDelete — Delete element
$collection_field
)Delete a document field element. If the deleted element is the only element then the field is removed.
collection_field
The format of this parameter is FIELD_NAME[ INDEX ] where FIELD_NAME is the name of the document field to remove the element from, and INDEX is the INDEX of the element within the field.
The INDEX field is zero based, so the leftmost item from the array has an index of 0.
A CollectionModify object that can be used to execute the command, or to add further operations
Example #1 mysql_xdevapi\CollectionModify::arrayDelete() example
<?php
// Assuming $coll is a valid Collection object
// Remove the first element from the array of 'jobs' for all the documents
// with name like Riccardo or Carlo
$coll->modify("name in ('Riccardo', 'Carlo')")->arrayDelete('job[0]')->execute();
// Remove the second element from the documents which `age` field is greater than 30
$coll->modify('age > 30')->arrayDelete('job[1]')->execute();
?>