10bet网址
MySQL PHP API
Download this Manual
PDF (US Ltr)- 2.4Mb
PDF (A4)- 2.4Mb


MySQL PHP API/.../ CollectionFind::__construct

5.9.2CollectionFind::__construct

Copyright 1997-2021 the PHP Documentation Group.

  • CollectionFind::__construct

    CollectionFind constructor

Description

privatemysql_xdevapi\CollectionFind::__construct();

Warning

This function is currently not documented; only its argument list is available.

Parameters

This function has no parameters.

Examples

Example 5.30 CollectionFind example

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()); ?>

The above example will output something similar to:

array(1) { [0]=> array(4) { ["_id"]=> string(28) "00005b6b536100000000000000cf" ["age"]=> int(18) ["job"]=> string(6) "Butler" ["name"]=> string(6) "Alfred" } }