In MongoDB I've a class with a property MyProperty of type object
.
public MyClass
{
public object MyProperty;
public string Prop1;
public DateTime Prop2;
public int Prop3;
}
Serialization to MongoDB works without any problem creating a JSon of this type:
MyProperty" : {
"_t" : "ExampleClass",
[...]
}
But when I try do seserialize it I get the following error:
An error occurred while deserializing the MyProperty property of class MyClass: Unknown discriminator value 'ExampleClass'.
I'd like to deserialize MyProperty to a simple generic BsonDocument or to a string.