Say I have a business. If I want to turn an object whose class is Business into a BsonDocument, I would do
aBusiness.ToBsonDocument
Great.
What about if I want to turn a BsonDocument into aBusiness class? Is there an easy way?
Public Shared Function ToBsonDocument(Of TNominalType)(ByVal obj As TNominalType) As MongoDB.Bson.BsonDocument
Member of MongoDB.Bson.BsonExtensionMethods
What you need to do is deserialize your BSonDocument into your class.
Without having a more complete view of your class I can’t give a full example, but in general you would need to do something like:
You can find the API documentation for the BSonSerializer here
You can also see a similar question for C# here