Hi guys,

Lately I worked a bit on the Pharo Mongo driver for SmalltalkHub. I made
several changes (in the new version 1.4):

The query API changed:

- MongoCollection>>query: now takes a 1 arg block, improving the API
quite a bit. 

Queries like:

aCollection query: (aCollection query 
    query: { 'foo' -> 'bar'} asDictionary;
    yourself)

Is now written:

aCollection query: [ :query |
    query where: { 'foo' -> 'bar'} ]

Sending #asDictionary has also been made optional, the query builder
will send #asMongoQuery to the query collection.


The MongoQueries package:

Version 1.4 comes with a new package MongoQueries, a small DSL allowing
us to use traditional blocks instead of dictionaries to perform
queries. This is optional and backward compatible.

Queries like:

aCollection select: { '$or' -> { 'name' -> 'foo'. 'age' -> { '$gt' -> 23 }
asDictionary } asDictionary } asDictionary

can be expressed:

aCollection select: [ :each | (each name = 'foo') | (each age > 23) ]

The MongoQueries package should support the entire mongo query language
(including nested queries), and comes with unit tests.

Nico

Reply via email to