Hi, if this is from voyage, then is a complicated query, because it is storing a reference to a second root. Letâs say you have an object a1 who is an instance of A and an object b1 who is an instance of B. b := B new. a := A new data1: 42; data2: âsomethingâ; refB: b. which means what you want, in plain Pharo would be something like this: aCollectionOfA select: [ :each | each refB = b ]. but since you want to use Voyage, I guess you want to execute the query *in mongo* (to avoid loading all instances of A into memory). So, in voyage you need to do it in some hack way: B selectOne: [ :each | ⦠]. A selectMany: [ :each | (each at: ârefB.__idâ) = b voyageId ]. this will solve your problem, I guess. Esteban ps: this is hacky because what in general you do with this kind of structures is to keep a list of A in B, along with your list of B in A (that means, you define a many-to-many relationship)
On 22 Nov 2016, at 11:42, Asbath Sama biyalou via Pharo-users <pharo-users@lists.pharo.org> wrote:
From: Asbath Sama biyalou <asamabiyalou@yahoo.com> Subject: Rest Services with pharo objects as parameters Date: 22 November 2016 at 11:42:25 GMT+1 To: Pharo users users <pharo-users@lists.pharo.org>
Hello Everybody.
I have two classes ClassA(data1 data2 ref_ClassB) ClassB (data3 data4).
I want to get list of classA where ref_ClassB = ClassB. I don't know how to do my url in order
to sent ClassB as a parameter of the service. I am using Pharo 4.0 with Voyage-Mongo.