Hi, this seems to answer your question. http://articles.tulipemoutarde.be/embedded-document-with-voyage-in-mongodb Fernando On Sun, Nov 25, 2012 at 2:09 AM, Igor Stasenko <siguctua@gmail.com> wrote:
On 24 November 2012 14:06, Nicolas Petton <petton.nicolas@gmail.com> wrote:
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.
are you talking about serializing objects (or subgraphs) directly, and storing them in mongo db ?
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
-- Best regards, Igor Stasenko.