Am 24.11.2012 um 14:06 schrieb Nicolas Petton <petton.nicolas@gmail.com>:
Thanks Norbert!
It's cool to know that you like it :) Together with Esteban's work on Voyage, it allows us to do extremely cool stuff with Mongo and Pharo.
What I like with Voyage-Mongo + MongoQueries is that objects are persisted without any effort, it just works, and we can query Mongo collections like we would do with Smalltalk collections.
Sure, that sounds cool. I didn't look into the new voyage, yet. But I need to tell Esteban how cool it is to clear a past misunderstanding :) Norbert
Nico
Norbert Hartl <norbert@hartl.name> writes:
Hey Nico,
I looked into your new stuff and I like it. Especially the MongoQueries stuff is very simple and clean approach to do a small DSL. That boosts the usability of MongoTalk extremely. Bravo!
Norbert
Am 19.11.2012 um 15:37 schrieb Nicolas Petton <petton.nicolas@gmail.com>:
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
-- Nicolas Petton http://nicolas-petton.fr