Is it possible to create two MongoClient
with different serialization logic? For example, we need to write the same data type in different collections with different logic of field serialization by BsonClassMap
.
BsonClassMap.RegisterClassMap
is static and applies to the entire project. I need to get away from this.
For example, there is a class
public class A { public int Field { get; set; } } public class Doc { public A _A { get; set; } }
the same Doc
instance needs to be written in the DB collection
to collection 1 { _A : { Field : 5 } }
to collection 2 { _A : { Field : "Value Is 5" } }
as we see in collection 2, we use a serializer that translates the number 5 into the string " Value Is 5
".
How to implement it?