-
Type:
Improvement
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 1.8.2
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The serializers for GeoJson objects are too strict when deserializing and require that numeric values be doubles. They should allow other numeric formats (Int32 and Int64) and convert to double.
For example, given the following class.
public class C { public ObjectId Id { get; set; } public GeoJson2DCoordinates Pos { get; set; } }
the following works:
var c = BsonSerializer.Deserialize<C>("{ Pos : [1.0, 2.0] }");
but the following does not:
var d = BsonSerializer.Deserialize<C>("{ Pos : [1, 2] }");