The C# driver has the general notion of being able to specify the
representation used to store a property (though not all possible
combinations are valid), so perhaps the following would be useful:
public class C {
// other fields
[BsonRepresentation(BsonType.Double)]
public decimal D;
}
NOTE: the serializer does not currently support this representation
for decimal, but it sounds useful. It would mean the value is
represented as a decimal in memory but as a double in the serialized
BSON document. It would also make queries against the field easier.
However, read the next paragraphs...
By default the serializer throws an OverflowException or a
TruncationException when converting between numeric types results in
loss of magnitude or precision, but you can override that as follows:
public class C {
// other fields
[BsonRepresentation(BsonType.Double, AllowTruncation=true)]
public decimal D;
}
Presumably AllowOverflow=true is not as useful as loss of magnitude is
a far bigger error than loss of precision. Even loss of precision
means that it is possible that you might not read back from the
database the EXACT same value you put in (which is why a string
representation is the default).