Skip to content

Instantly share code, notes, and snippets.

Created Jan 22, 2018
What would you like to do?
Bson Serialization/Deserialization
void Main()
var bson = new MongoDB.Bson.BsonDocument(new Dictionary<string, object>
["ChildishField"] = "childish",
["AnotherChildishField"] = "more childish"
var serialized = bson.ToString().Dump();
public abstract class MyAbstract
public string DontCare;
[BsonIgnoreExtraElements] // comment this out and it throws as expected
public sealed class Child1 : MyAbstract
public string ChildishField;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment