Hi Diego -
Salat deserializes a collection that is not present using the default
argument supplied by you in the case class constructor.
You can combine this with a setting in Context that suppresses
serializing any field whose value is equal to the supplied default
argument. Here's a gist showing what I mean:
https://gist.github.com/3285885
Now, this doesn't only affect collections - it affects all fields with
default arguments except a field with the name or mapping "_id" (via
@Key or using context overrides).
Depending on how you use your document collection, this might or might
not be suitable for your use. But it is very effective at shrinking
document size.
Best,
Rose
On Aug 7, 10:09 am, Diego Varese <
diego.var...@gmail.com> wrote:
> In my case the map will have a value in a very small number of scenarios,
> it will usually be None. Using an empty Map as the default value means that
> the mongo db gets littered with empty maps all over the place. Is there a
> way to have empty collections be omitted when serializing to Mongo, and be
> recovered as empty collections when deserializing? How does Salat
> deserialize a collection field that is not present in the mongo entry?