2 require "../ActiveMongo.php";
5 ActiveMongo
::connect("activemongo_test");
7 /* Create index (and therefore our collection) */
11 for ($i=0; $i < 500; $i++
) {
13 $user->username
= uniqid();
14 $user->password
= uniqid();
16 $user->save(false); /* perform a non-safe but fast save() */
19 /* Simple selection */
22 foreach ($users->find() as $id=>$u) {
23 var_dump(array('first loop', $id, $u->password
));
26 /* Complex selection, it gives you the control
27 * over MongoDB Collection
29 foreach ($users->my_selector() as $id => $user) {
30 var_dump(array($id, $user->uid
, $user->password
));