rejectedsoftware/vibe.d — pull request #913 by intrica (2014-12-04 02:40:03+00:00)
Title: Fix problems deserializing Bson long into int

Adds the ability to deserialize a Bson long into a native int. This could be problematic for numbers outside the range of int but it should probably be checked by the developer if they are taking Bson input. This caused quite a headache when we have data coming from a Json api and wanted to merge with the Bson from MongoDB before deserializing.

This code previously did not work:

```D
int dest;

auto jsonSource = Json(2048); // Imagine this came from a web request
assert(jsonSource.type == Json.Type.int_); // The Json type is int

auto source = Bson.fromJson(jsonSource); // We could do this so we can merge with a Bson object loaded from the database
assert(source.type == Bson.Type.long_); // The Bson object now has a long

dest.deserializeBson(source); // This caused an error as it was conversion from long to int

```