no, it should not be implemented, no need to make him answer false (in fact, I never tried, but I'm pretty sure that is you reimplement isVoyageRoot to answer false in the subclasses most probably you will get a class that is transient :( ). reason is that voyage looks the root class of a hierarchy by noticing where is #isVoyageRoot = true implemented. (again, each time I look in this "design decisions" I feel a bit ashamed... but well, they looked good at the moment :) ) Esteban On Sep 10, 2013, at 5:06 PM, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
Esteban,
I didn't know about the #isVoyageRoot difference based on where was the method defined.
I mean... if I define Member class>>#isVoyageRoot ^true
why sould SingleMember answer false?
Do I have to redefine it to answer false in each of Member subclasses?
Regards!
Esteban A. Maringolo
2013/9/10 Esteban Lorenzano <estebanlm@gmail.com> Hi,
what happens is that if you declare a "kind", you forces all elements to be of that specific class. Solution is just not add that property:
<mongoDescription> ^VOMongoToManyDescription new attributeName: 'members'; accessor: #members; "kind: Member; " "<-- NO!" beLazy; yourself.
And same happens in the <mongoContainer> description in the top of your hierarchy... you must NOT declare a kind. Also, if you want all members to go in just one collection. #isVoyageRoot has to be implemented in the top of the hierarchy and not in the subclasses
Member "<-- #isVoyageRoot = true here!" SingleMember ComplexMember
what happens then is that voyage will create a collection and for each document it stores in it will also store the attribute '#instanceOf', which will be used to retrieve the correct object.
Esteban
what happens then is that
On Aug 31, 2013, at 12:53 AM, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
More or less, I have this working.
In the Group class I have a description named: descriptionMembers <mongoDescription> ^VOMongoToManyDescription new attributeName: 'members'; accessor: #members; kind: Member; beLazy; yourself
And in the Member class I have descriptionGroups <mongoDescription> ^VOMongoToManyDescription new attributeName: 'groups'; accessor: #groups; kind: Group; beLazy; yourself
But what if Member is an abstract class and the elements can be any of SingleMember or ComplexMember?, each one is stored in a separate collection in Mongo.
If I do specify #kind: Member in my #descriptionMembers it won't work.
Any ideas?
Regards,
Esteban A. Maringolo
2013/8/30 Esteban A. Maringolo <emaringolo@gmail.com>:
2013/8/30 James Foster <Smalltalk@jgfoster.net>:
It seems that I mistook the question for something easy enough for me to answer! Unfortunately, I don't have any knowledge of Voyage+MongoDB so can't really give the proper answer.
Thanks anyway, it is a problem you'll never find in GemStone/S ;-)