I am in Mongo-C# environment and using 10Gen Mongo driver. i am facing a problem when I am trying to deserialize the data inside the Mongo document when it has a sub document and that sub document is not strongly typed. In other words, if the sub document is an Expando or simply an anonymous object() then it give errors out while deserializing with the following error:
System.IO.FileFormatException: A document being deserialized to System.Object must be empty.
We I can put a filter before and after the Mongo read/write which converts my Object into a BSONDocument on the fly but I think there is not cast available between BSOnDocument and (Expando or anonymous type).
Writting a custom deserialization tool sounds like too much work for this. I am just wondering is someone has faced this problem before and how they have handled this problem?