Sabine,

maybe my description wasn't clear enough. If you start to use voyage like that 
you have the constraint that all objects returned from the collection need to 
be the same or a subclass of the one you are using to search. Meaning

If you query

One selectAll

then all of the objects in the Numbers collection need to be the same class or 
a subclass of One. So this use case is at first only feasible if you want to 
find all instances of Numbers. Your basic query needs to be

Numbers selectAll

If you then want to deal only with instances of One you would need to add this 
to the query

Numbers selectMany: {
        '#instanceOf' -> #One } asDictionary

This is not a nice approach but for this use case it should give you the desire 
result.

Norbert

> Am 09.03.2016 um 10:52 schrieb Sabine Manaa <manaa.sab...@gmail.com>:
> 
> Norbert, thank you. Ok, the Numbers collection name is clear.
> 
> If I use
> 
> <mongoContainer>
>       ^ VOMongoContainer new
>               collectionName: 'Numbers';
>               yourself
> 
> the data is stored correctly in the Numbers collection in Mongo. Also the 
> relationship is fine.
> Everything fine till here.
> 
> But after 
> 
> VOMongoRepository current reset.
> 
> I have problems with fetching the data from mongo
> 
> If I define
> 
> mongoContainer
>       <mongoContainer>
>       ^ VOMongoContainer new
>               enableMissingContent;
>               collectionName: 'Numbers';
>               "kind: self;"
>               yourself
> 
> Then I get the error "Bad object requested (Three does not inherits from One)"
> 
> If I define 
> 
> mongoContainer
>       <mongoContainer>
>       ^ VOMongoContainer new
>               enableMissingContent;
>               collectionName: 'Numbers';
>               kind: self;
>               yourself
> 
> Then I get an Inspector with 3 instances of "One" (I refer to the workspace 
> of the image from tommasso)
> It should be only one instance of One
> Clicking on the one instances, I get an emergency screen with
>  ***System error handling failed****
> VOMongoError: Lazy reference not found ...
>  
> Tommasso, do you get the same results?
> 
> I am curious about the solution.
> 
> 
> ***************This is the workspace of tommasso
> repository dropDatabase.
> repository := VOMongoRepository
>               host: 'localhost'
>               database: 'VoyageMongo-Link-Test-5'.
>               
> repository enableSingleton.
> 
> one := One new.
> two := Two new.
> three := Three new.
> 
> one link: two.
> one link: three.
> 
> one save.
> two save.
> three save.
> 
> VOMongoRepository current reset.
> 
> One   selectAll  
> 
> View this message in context: Re: Voyage, Magritte descriptions, and nil 
> exceptions 
> <http://forum.world.st/Voyage-Magritte-descriptions-and-nil-exceptions-tp4882726p4883467.html>
> Sent from the Pharo Smalltalk Users mailing list archive 
> <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at Nabble.com.

Reply via email to