<slide>
<title>Querying: matching array elements ($elemMatch)</title>

<example result="1"><![CDATA[<?php
$m = new MongoClient;
$c = $m->demo->continent;
$r = $c->find( [
    'cities' => [
        '$elemMatch' => [
            'population' => [ '$gte' => 11000000 ],
            'dem' => [ '$gte' => 100 ],
        ]
    ]
] );

foreach( $r as $c ) {
    echo $c['name'], "\n";
    foreach( $c['cities'] as $city ) {
        echo '- ', $city['name'], ': ', $city['population'], ' - ', $city['dem'], "\n";
    }
}
?>]]></example>
</slide>
