diff --git a/Realm/RLMBSON.mm b/Realm/RLMBSON.mm index 4abf8d8f6c..e3d3788f1a 100644 --- a/Realm/RLMBSON.mm +++ b/Realm/RLMBSON.mm @@ -386,7 +386,7 @@ BsonDocument RLMConvertRLMBSONArrayToBsonDocument(NSArray> *array) { case realm::bson::Bson::Type::Timestamp: return [[NSDate alloc] initWithTimeIntervalSince1970:static_cast(b).seconds]; case realm::bson::Bson::Type::Datetime: - return [[NSDate alloc] initWithTimeIntervalSince1970:static_cast(b).get_seconds()]; + return [[NSDate alloc] initWithTimeIntervalSince1970:double(static_cast(b).get_seconds()) + double(static_cast(b).get_nanoseconds() / 1000) / 1000000]; case realm::bson::Bson::Type::ObjectId: return [[RLMObjectId alloc] initWithValue:static_cast(b)]; case realm::bson::Bson::Type::Decimal128: