I am having trouble moving between mongodb and json.net due to polymorphic types. the c# mongodb driver users _t as the discriminator property name and json.net uses $type. I know json.net has this value hardcoded from other research. My question is if anyone knows of a way to rename "_t" to "$type" using the c# mongodb driver?
I believe you can can create a custom discriminator convention and you can add it to each type you wish to modify;
http://mongodb.github.io/mongo-csharp-driver/2.2/reference/bson/mapping/polymorphism/
Here's an example of a custom discriminator convention which might help you;
http://pastebin.com/9UweEKBe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With