Voyage, selectMany with multiple Root

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Voyage, selectMany with multiple Root

gonza
Hi people, I've been making a small project using Pharo and Voyage, and everything is going well, but I'm facing a performance issue when retrieving items from Mongo.

I've two classes, one for items, and other for users, and both are Root. Each item contains the user who created it.

My question is if there's a best way of querying all items for an user, using selectMany, when you have a document containing another.

As work-around, by now, I'm making a selectAll and then filter them on memory, and that takes a lot of time and memory when the collection grows.

Can you help on this?

Thanks,

Gonzalo
Reply | Threaded
Open this post in threaded view
|

Re: Voyage, selectMany with multiple Root

NorbertHartl
Hi Gonzalo,

that is indeed something that is missing in voyage to make that kind of queries more easy. But you can do it using something like that

itemsForUser: aUser
        ^ Item selectMany: {
                'user.__id' -> aUser voyageId } asDictionary


Norbert

Am 18.09.2014 um 03:06 schrieb gonza <[hidden email]>:

> Hi people, I've been making a small project using Pharo and Voyage, and
> everything is going well, but I'm facing a performance issue when retrieving
> items from Mongo.
>
> I've two classes, one for items, and other for users, and both are Root.
> Each item contains the user who created it.
>
> My question is if there's a best way of querying all items for an user,
> using selectMany, when you have a document containing another.
>
> As work-around, by now, I'm making a selectAll and then filter them on
> memory, and that takes a lot of time and memory when the collection grows.
>
> Can you help on this?
>
> Thanks,
>
> Gonzalo
>
>
>
> --
> View this message in context: http://forum.world.st/Voyage-selectMany-with-multiple-Root-tp4778705.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>