<slide>
<title>Exercise 1: Connecting and creating indexes</title>

<list>
    <bullet>%wget http://derickrethans.nl/files/dump/mongo-exercise1.php.txt%</bullet>
    <bullet>Open it in your favourite editor and edit.</bullet>
</list>
<example><![CDATA[<?php
$file = $argv[1];

// 1 ADD: Set variable $m to the connection, and $d to the collection "poi" in
// the database "demo" on localhost
$m = new MongoClient();
$d = $m->demo->poi;

// 2 ADD: Drop the collection
$d->drop();

// 3 ADD: Create an index on "name" and a "2d" index on "loc"
$d->createIndex( [ 'loc' => '2d' ] );
$d->createIndex( [ 'name' => 1 ] );

var_dump($d->getIndexInfo());
]]></example>
<list>
    <bullet>Run the script!</bullet>
</list>
</slide>
