<?php
$m = new MongoClient;
$c = $m->demo->products;
$c->drop();
$c->insert( [ '_id' => 'blue-elephpant', 'generation' => 1, 'price' => 7.5 ] );
$c->insert( [ '_id' => 'pink-elephpant', 'generation' => 2, 'price' => 8.0 ] );
$c->insert( [ '_id' => 'green-elephpant', 'generation' => 3, 'price' => 7.5 ] );
$c->update(
[ 'generation' => [ '$lte' => 2 ] ], // criteria
[ '$inc' => [ 'price' => -2.0 ] ], // update spec
[ 'multiple' => true ] // options: multiple
);
?>