Good to know!
2013/7/4 Esteban Lorenzano <esteba...@gmail.com> > you also have regexp expressions (and I think they are better than the > where clause): > > { > #name -> { > '$regex' -> '^P*'. > '$options' -> 'i' > } asDictionary > } asDictionary > > there is no support for it with MongoQueries, but they work fine with > dictionaries :) > > Esteban > > On Jul 4, 2013, at 7:36 PM, Bernat Romagosa < > tibabenfortlapala...@gmail.com> wrote: > > For other kinds of matches, you need javascript queries, if I understood: > > User selectOne: [ :each | each where: 'this.name[0] == "s"' ] > > Right? > > > 2013/7/4 Stéphane Ducasse <stephane.duca...@inria.fr> > >> Ok but how do I map conceptual a query to a dictionary >> >> Do I guess right that there is an exact match >> >> selectOne: { id -> 10} asDictionary >> >> will match id = 10 >> >> Now we can only do exact mathc? >> >> name matches: 'stef*' >> >> >> On Jul 4, 2013, at 6:04 PM, Esteban A. Maringolo <emaring...@gmail.com> >> wrote: >> >> > Stef, >> > >> > You're asking the other Esteban, but having used Voyage and Mongo I >> > think I can answer this. >> > >> > Mongo receives a JSON object to do all the query filtering. For a >> > simple lookup it is has a simple structre, as the query gets more >> > complex it gets esoteric as well (with "special" MongoDB keys in the >> > format of "$key"). >> > >> > Because the simplest map we have to a JSON Object is the Dictionary, I >> > guess that's why it ends up being converted to a Dictionary, which in >> > turn gets converted to JSON and/or BSON. >> > >> > Regards, >> > >> > Esteban A. Maringolo >> > >> > >> > 2013/7/4 Stéphane Ducasse <stephane.duca...@inria.fr>: >> >> >> >> On Jul 4, 2013, at 2:58 PM, Esteban Lorenzano <esteba...@gmail.com> >> wrote: >> >> >> >> Hi :) >> >> >> >> can you check if you have the "MongoQueries" package installed? >> >> >> >> cheers, >> >> Esteban >> >> >> >> ps: please notice that in anycase you will not be able to execute >> >> >> >> [ :each | each name first = $X ] >> >> >> >> because the MongoQueries package just translates the block into a >> >> mongo-query which is a dictionary (a JSON expression). But you will >> found >> >> some ways to help you, some special keywords like #in: and #where: >> (you can >> >> see how they work in the tests) >> >> >> >> >> >> esteban >> >> how a dictionary is used to work as a block for a query? >> >> Can you explain because I would have thought that the first line did >> not >> >> work and the second would work. >> >> >> >> Stef >> >> >> >> >> >> >> >> >> >> On Jul 4, 2013, at 2:17 PM, Bernat Romagosa < >> tibabenfortlapala...@gmail.com> >> >> wrote: >> >> >> >> Hi! >> >> >> >> I realize probably only Esteban will be able to answer, but I prefer to >> >> write to the list so the mail is logged and other people can benefit >> from >> >> it. >> >> >> >> I'm trying to use blocks as arguments for #selectOne: and >> #selectMany:, but >> >> it doesn't seem to work. Here's my code: >> >> >> >> MyClass selectOne: { #name -> 'Some name' } asDictionary. >> >> MyClass selectOne: [ :each | each name = 'Some name' ]. >> >> >> >> >> >> The first one works, but the second one raises a >> VOMongoConnectionError. >> >> >> >> Also: >> >> >> >> MyClass selectMany: { #name -> 'Some name' } asDictionary. >> >> MyClass selectMany: [ :each | each name = 'Some name' ]. >> >> >> >> >> >> The first does work, the second one doesn't, which prevents me from >> writing >> >> more useful stuff like: >> >> >> >> MyClass selectMany: [ :each | each name first = $P ]. >> >> >> >> Any idea why this could be failing? I've the latest stable version >> loaded >> >> via: >> >> >> >> Gofer it >> >> url: 'http://smalltalkhub.com/mc/estebanlm/Voyage/main'; >> >> package: 'ConfigurationOfVoyageMongo'; >> >> load. >> >> (Smalltalk at: #ConfigurationOfVoyageMongo) load. >> >> >> >> Thanks! :) >> >> >> >> Bernat. >> >> >> >> -- >> >> Bernat Romagosa. >> >> >> >> >> >> >> > >> >> >> > > > -- > Bernat Romagosa. > > > -- Bernat Romagosa.