public static BsonDocument NonUcumIndexed(this Model.Quantity quantity) { string system = (quantity.System != null) ? quantity.System.ToString() : null; BsonDocument block = new BsonDocument { { "system", system }, { "value", quantity.GetValueAsBson() }, { "unit", quantity.Code } }; return(block); }
public static BsonDocument NonUcumIndexed(this FM.Quantity quantity) { var system = quantity.System != null ? (BsonValue)quantity.System : BsonNull.Value; var code = quantity.Code != null ? (BsonValue)quantity.Code : BsonNull.Value; var block = new BsonDocument { { "system", system }, { "value", quantity.GetValueAsBson() }, { "unit", (BsonValue)quantity.Code ?? BsonNull.Value } }; return(block); }