MongoDB PHP Driver 1.0.3 Release

Version 1.0.3 was released today.  Everyone should upgrade because there were some weird bugs in 1.0.2 due to a half-complete feature that was added in 1.0.2 and has since been removed.  Unfortunately, because I’ve had to bump up the release date, the big feature that was scheduled for 1.0.3, asynchronous queries, has been pushed to 1.0.4.  Sorry guys.  However, I’m working hard on the asynchronous stuff and I’ll get 1.0.4 out the door ASAP.

The only API change in this release is the addition of client side cursor timeouts.  For example, to create a cursor that will wait 2.5 seconds for queries to complete:

$cursor = $collection->find()->timeout(2500);

Time is specified in milliseconds.  If the query takes longer than the specified timeout, a MongoCursorTimeoutException will be thrown.  Timeouts do not affect MongoDB itself, your query will still be running on the server. It is merely a client side convenience.

Also, array serialisation is significantly faster in this version (only “normal” array serialisation, not associative array serialisation).

kristina chodorow's blog