(No version information available, might only be in Git)
CollectionModify::arrayAppend — 配列のフィールドに要素を追加する
$collection_field, string $expression_or_literal): mysql_xdevapi\CollectionModifyドキュメントのフィールドに要素を追加します。 フィールドの複数の要素は配列として表現されます。 arrayInsert() と異なり、arrayAppend() は常に新しい要素を配列の最後に追加します。 一方で、arrayInsert() は挿入する位置を指定できます。
collection_field新しい要素を挿入するフィールドの識別子
expression_or_literalドキュメントフィールドの配列の最後に挿入する新しい要素
コマンドを実行したり、追加の操作を追加できる CollectionModify オブジェクトを返します。
例1 mysql_xdevapi\CollectionModify::arrayAppend() の例
<?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");
$result = $collection
  ->add(
  '{"name":   "Bernie",
    "traits": ["Friend", "Brother", "Human"]}') 
  ->execute();
$collection
  ->modify("name in ('Bernie', 'Jane')")
  ->arrayAppend('traits', 'Happy')
  ->execute();
$result = $collection
  ->find()
  ->execute();
print_r($result->fetchAll());
?>上の例の出力は、 たとえば以下のようになります。
Array
(
    [0] => Array
        (
            [_id] => 00005b6b5361000000000000010c
            [name] => Bernie
            [traits] => Array
                (
                    [0] => Friend
                    [1] => Brother
                    [2] => Human
                    [3] => Happy
                )
        )
)
