2024 年 PHP Conference Japan

CollectionRemove::__construct

(沒有版本資訊,可能只存在於 Git 中)

CollectionRemove::__constructCollectionRemove 建構函式

說明

私有 mysql_xdevapi\CollectionRemove::__construct()

移除集合文件,並由 mysql_xdevapi\Collection::remove() 方法實例化。

參數

此函數沒有參數。

範例

範例 #1 mysql_xdevapi\Collection::remove() 範例

<?php
$session
= mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$session->sql("DROP DATABASE IF EXISTS addressbook")->execute();
$session->sql("CREATE DATABASE addressbook")->execute();

$schema = $session->getSchema("addressbook");
$collection = $schema->createCollection("people");

$collection->add('{"name": "Alfred", "age": 18, "job": "Butler"}')->execute();
$collection->add('{"name": "Bob", "age": 19, "job": "Painter"}')->execute();

// 移除所有油漆工
$collection
->remove("job in ('Painter')")
->
execute();

// 移除最老的管家
$collection
->remove("job in ('Butler')")
->
sort('age desc')
->
limit(1)
->
execute();

// 移除年齡最小的紀錄
$collection
->remove('true')
->
sort('age desc')
->
limit(1)
->
execute();
?>
新增筆記

使用者貢獻的筆記

此頁面尚無使用者貢獻的筆記。
To Top