unknown discriminator value mongodb

C#
BsonClassMap.RegisterClassMap<MyClass>();

// or:

[BsonDiscriminator("MyClass")]
public class MyClass
{ ... } 
Source

Also in C#: