PHP driver version 1.0.2 released!

9 views
Skip to first unread message

Kristina Chodorow

unread,
Dec 17, 2009, 4:18:11 PM12/17/09
to mongod...@googlegroups.com
There are lots of changes in this release. From most cool to most trivial:

1. Getters have been implemented on Mongo, MongoDB, and MongoCollection.  You can now say:

$m = new Mongo();
$m->foo->bar->baz->insert(array("x" => "y"));

...instead of $m->selectDB("foo")->selectCollection("bar.baz")->insert(array("x"=>"y")).

2. Less stupid connection parameters.  Instead of remembering whether you want new Mongo("localhost", false, true, false) or new Mongo("localhost", false, false, true).  It's more intuitive and doesn't break backwards compatibility, so your old code will still work.  Here's the new way (starting with "mongodb://" isn't strictly required, but it's recommended):

// connecting to multiple machines (any number!)
new Mongo("mongodb://localhost:27017,localhost:27018,localhost:27019")

// persistent connection
new Mongo("mongodb://localhost", array("persist" => true));
// persistent connection with non-default identifier
new Mongo("mongodb://localhost", array("persist" => "foobar"));

// not connecting immediately
new Mongo("mongodb://localhost", array("connect" => false));

// log into the admin database after connecting
new Mongo("mongodb://myUsername:myPassword@localhost");

These options can all be combined in any way, so in the "worst" case you'll have something like:
new Mongo("mongodb://myUsername:myPassword@localhost:27017,localhost:27018", array("connect" => false, "persist" => "foobar"));

(http://www.php.net/manual/en/mongo.construct.php)

3. Extract the timestamp from when a document was created with MongoId::getTimestamp() (http://www.php.net/manual/en/mongoid.gettimestamp.php).

4. The distinct command ($db->command(array("distinct" => ...))) can be passed a "query" field (http://groups.google.com/group/mongodb-user/browse_thread/thread/980284b25a29c338/8656f45617e1c677).

5. ensureIndex takes "dropDups" and "safe" options (http://www.php.net/manual/en/mongocollection.ensureindex.php).

These changes will be documented in the manual (http://php.net/manual/en/book.mongo.php) when it is regenerated tomorrow (Friday).  Enjoy!

-------

Other stuff:

From now on we'll be releasing a new version of the PHP driver monthly.  Plan on upgrading on the third Thursday of the month.

Coming attractions for next month: In a world without ACID compliance, one driver is releasing asynchronous queries and client-side cursor timeouts.  If there are other things you'd like to see, please suggest them at http://jira.mongodb.org/browse/PHP.

Get involved:
Drupal does MongoDB: http://drupal.org/project/mongodb
Mongodloid: we're thinking this would be a great thing to turn into a Zend module for MongoDB.  See http://code.google.com/p/mongodloid/.

P.S. Wouter: I've put in the Windows VC6 build request, will ping you when it's up :)

Prajwal Tuladhar

unread,
Dec 17, 2009, 4:24:39 PM12/17/09
to mongodb-user
Will the code based on old PHP driver work with this one without any
issue?

> passed a "query" field (http://groups.google.com/group/mongodb-user/browse_thread/thread/9802...


> ).
>
> 5. ensureIndex takes "dropDups" and "safe" options (http://www.php.net/manual/en/mongocollection.ensureindex.php).
>
> These changes will be documented in the manual (http://php.net/manual/en/book.mongo.php) when it is regenerated tomorrow
> (Friday).  Enjoy!
>
> -------
>
> Other stuff:
>
> From now on we'll be releasing a new version of the PHP driver monthly.
> Plan on upgrading on the third Thursday of the month.
>
> Coming attractions for next month: In a world without ACID compliance, one
> driver is releasing asynchronous queries and client-side cursor timeouts.

> If there are other things you'd like to see, please suggest them athttp://jira.mongodb.org/browse/PHP.


>
> Get involved:
> Drupal does MongoDB:http://drupal.org/project/mongodb
> Mongodloid: we're thinking this would be a great thing to turn into a Zend

> module for MongoDB.  Seehttp://code.google.com/p/mongodloid/.

Kristina Chodorow

unread,
Dec 17, 2009, 4:29:03 PM12/17/09
to mongod...@googlegroups.com
It should!  Everything should be backwards compatible, let me know if anything isn't.


--

You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.



Kristina Chodorow

unread,
Dec 17, 2009, 5:31:32 PM12/17/09
to mongod...@googlegroups.com

diegomsana

unread,
Dec 18, 2009, 5:35:30 AM12/18/09
to mongodb-user
The $m->foo->bar->baz->insert(array("x" => "y")); thing is awesome ;)

> passed a "query" field (http://groups.google.com/group/mongodb-user/browse_thread/thread/9802...


> ).
>
> 5. ensureIndex takes "dropDups" and "safe" options (http://www.php.net/manual/en/mongocollection.ensureindex.php).
>
> These changes will be documented in the manual (http://php.net/manual/en/book.mongo.php) when it is regenerated tomorrow
> (Friday).  Enjoy!
>
> -------
>
> Other stuff:
>
> From now on we'll be releasing a new version of the PHP driver monthly.
> Plan on upgrading on the third Thursday of the month.
>
> Coming attractions for next month: In a world without ACID compliance, one
> driver is releasing asynchronous queries and client-side cursor timeouts.

> If there are other things you'd like to see, please suggest them athttp://jira.mongodb.org/browse/PHP.


>
> Get involved:
> Drupal does MongoDB:http://drupal.org/project/mongodb
> Mongodloid: we're thinking this would be a great thing to turn into a Zend

> module for MongoDB.  Seehttp://code.google.com/p/mongodloid/.

Graham Ballantyne

unread,
Jan 2, 2010, 3:52:23 AM1/2/10
to mongodb-user, he...@grahamballantyne.com
(Apologies if this is a duplicate post; I don't think the first one
went through…)

Would it be possible to get an updated precompiled version for MAMP on
OS X (PHP 5.2)? The one on the wiki is for 5.3 and doesn't work:
[02-Jan-2010 00:51:07] PHP Warning: PHP Startup: mongo: Unable to
initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0

Graham Ballantyne

unread,
Jan 2, 2010, 3:39:26 AM1/2/10
to mongodb-user
Would it be possible to get an updated binary for MAMP/OS X (PHP 5.2)?
The one on the wiki appears to be the old one (e.g. I'm getting an
error when trying to use ensureIndex(): MongoCollection::ensureIndex()
expects parameter 2 to be boolean, array given in...)

Kristina Chodorow

unread,
Jan 5, 2010, 11:03:35 AM1/5/10
to mongod...@googlegroups.com
Sorry about the delay... you can download the binary for 1.0.2 here:

http://cloud.github.com/downloads/mongodb/mongo-php-driver/mongo-v1.0.2-r1-php5.2ts-osx.tgz

Let me know if you have any problems.

Pre-1.0.2, the second parameter was just "true" for a unique index or "false" for non-unique (that's in the changelog at http://www.php.net/manual/en/mongocollection.ensureindex.php).


--

You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages