I'm working on a project using MongoDB with ODM especially for the schemaless features.
So I have one collection with some default fields in my base class.
Every inherited class add fields but we're still in the same collection.
First, prior to save the document, I add the new mappings (imported from the inherited class) so they will be saved in the database. This part works fine.
The problem is that when the ODM hydrates the documents, it sticks to the $metadata->fieldMappings defined by the base class, and ignore the others.
I've made a quick patch for that, but it doesn't make any type cast, I didn't inspect the code deep enough to make it better.
In the Doctrine\ODM\MongoDB\Hydrator class (line 73) :