Am 31.08.2013 um 02:18 schrieb Esteban A. Maringolo <[email protected]>:
> I think that the question could be rephrased as: > > How to map a collection with elements of different classes? > > Am I asking for too much? > No, but this isn't a trivial problem. For your specific case it is probably not implemented. I still didn't find the time to look into voyage but I think it has basically two modes: Either you use it plain (no magritte) and types are inferred from the object. Voyage then adds the information about the class in the json being serialized. If you use magritte then it can take the information from the description. So your case is a mix of the two. You can take basic information from the description but if it comes to inheritance you still need to add the class information in the json to be able to deserialize properly. The sad story about this is that relationships aren't perfect in magritte and nobody finds time to work out a proper solution. For your case and other problems there needs to be a fix and having separate descriptions for homogenous and heterogenous collections might be an approach that solves a few things. Norbert > > Esteban A. Maringolo > > > 2013/8/30 Esteban A. Maringolo <[email protected]>: >> 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 <[email protected]>: >>> 2013/8/30 James Foster <[email protected]>: >>>> 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 ;-) >
