array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ru', ), 'this' => array ( 0 => 'mysql-xdevapi-collectionfind.construct.php', 1 => 'CollectionFind::__construct', ), 'up' => array ( 0 => 'class.mysql-xdevapi-collectionfind.php', 1 => 'mysql_xdevapi\\CollectionFind', ), 'prev' => array ( 0 => 'mysql-xdevapi-collectionfind.bind.php', 1 => 'CollectionFind::bind', ), 'next' => array ( 0 => 'mysql-xdevapi-collectionfind.execute.php', 1 => 'CollectionFind::execute', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ru', 'path' => 'reference/mysql_xdevapi/mysql_xdevapi/collectionfind/construct.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(No version information available, might only be in Git)
CollectionFind::__construct — Конструктор класса CollectionFind
Функцию пока не задокументировали; для знакомства доступен только список аргументов.
У этой функции нет параметров.
Пример #1 Пример использования CollectionFind
<?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");
$create = $schema->createCollection("people");
$result = $create
->add('{"name": "Alfred", "age": 18, "job": "Butler"}')
->execute();
// ...
$collection = $schema->getCollection("people");
$result = $collection
->find('job like :job and age > :age')
->bind(['job' => 'Butler', 'age' => 16])
->execute();
var_dump($result->fetchAll());
?>
Вывод приведённого примера будет похож на:
array(1) { [0]=> array(4) { ["_id"]=> string(28) "00005b6b536100000000000000cf" ["age"]=> int(18) ["job"]=> string(6) "Butler" ["name"]=> string(6) "Alfred" } }