Hi Olivier,

possibly the option��
VOMongoContainer>>enableMissingContent;
is useful to avoid��
http://forum.world.st/Voyage-image-freeze-VOMongoError-Lazy-reference-not-found-td4703739.html

Here is an example:
http://esug.org/data/ESUG2013/4-Thu/03-ESUG2013%20-%20VoyageTutorial.pdf

Regards
Sabine




On Thu, Apr 17, 2014 at 3:07 PM, Olivier Auverlot [via Smalltalk] <[hidden email]> wrote:
thanks Robert for the explications.

I agree with you that's the best way to remove a book is to delete the reference in ��ComicsCollection.

But how to do that ? Must I simply remove the reference in the ordered collection ? Voyage will syncronize automatically the data in memory with the content of the database ? Must I force the save of the data after removing the reference ?

Olivier ;-)


2014-04-17 14:10 GMT+02:00 Norbert Hartl <[hidden email]>:


Am 17.04.2014 um 13:53 schrieb olivier <[hidden email]>:

> Hi,
>
> I'm using Voyage in a Pharo application.
>
> I have two MongoDB collections which are ComicsCollection and ComicsBook. Each book is attached to a instance of ComicsCollection. The reference of each book is stored in an ordered collection (in the instance of ComicsCollection). The problem is that if I remove a book, the reference to the book is not deleted from ComicsCollection.
>
> How can I remove properly a book and the reference to the book ?
>
From the smalltalk image view the problem is usually exactly the opposite: You don���t delete objects but you remove references to them. As voyage maps objects it is a good idea to stay in the object realm. So you should rather remove the book from the collection. This way you won���t get errors just garbage. The ���real��� problem that arises then is that the book would still be in the database. Just like it is in the image but there is no garbage collector for mongo. To decide that from the image is not possible. You load only a sub graph from the database into image memory. So you don���t know if there are other objects referencing the book.

If your records fit all in memory you could load all collections and books and build the difference between all referenced books in the collections and the total amount of books. The difference will be the set of objects not being referenced by a collection and those can be deleted.

If the records do not fit in memory an alternative strategy would be needed. I started to research if it is possible to build a map/reduce based garbage collector for common cases but got distracted. But I have the same problem so I will need to pick it up some time.

hope that helps,

Norbert






If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Voyage-how-to-delete-references-to-objects-tp4755088p4755092.html
To start a new topic under Pharo Smalltalk Users, email [hidden email]
To unsubscribe from Pharo Smalltalk Users, click here.
NAML



View this message in context: Re: Voyage: how to delete references to objects.
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.