I'm currently working at Ta Mère SCRL a small development shop in Belgium.
We mainly do mobile apps (iOS, Android) for clients. We also have a strong interest in Pharo Smalltalk and Rust.
Magritte is not necessary for the basic scenarios. Voyage is smart enough to infer the types of your instance variables and can serialize them. You don’t need to describe everything like you would do when building an UI with Magritte.
The Magritte descriptions are only needed when you want to override the defaults of want to have a one-to-many relationships.
In the future, it will be able to infer the to-many relations automatically but at the moment you still have to tell voyage how to deal with them.
^VOMongoToManyDescription new attributeName: 'myInstVar'; "Acts on this inst var" kindCollection: Set; "Set instead an OrderedCollection" beLazy; "I want that references to be retrieved lazily" yourself.
VOMongoRelationDescription and its subclasses to see what is possible.
As we’ve seen previously, it is pretty easy to map a relation. In our example, we declared both
MQPilot as persistent by implementing
isPersistent on the class side.
isPersistent method has an unfortunate name. It actually means that a collection with the name of the class will be created in the database. If we hadn’t declared
MQPilot persistent, it would have been completely embedded in the spaceship.
Sometimes you do not want to serialize all your instance variables. In such cases, add a
VOMongoTransientDescription like this:
mongoTransientDescription ^VOMongoTransientDescription new attributeName: 'puppies'; yourself.
puppies instance variable will be ignored by the serializer and won’t be stored in Mongo.
That’s all for today. Once again, huge thanks to Esteban for this super nice library!