I have to work the MongoDB C# Driver and Json.Net.
This sources installed from Nuget.
And i made a function of deserializer. It is as follows:
public static T ConvertTo<T>(this JsonSerializer serializer, BsonDocument bson)
{
using (var jsonReader = new JTokenReader(JToken.Parse( bson.ToJson())))
{
jsonReader. DateTimeZoneHandling = DateTimeZoneHandling.Local;
{
using (var jsonReader = new JTokenReader(JToken.Parse(
{
jsonReader.
var result = serializer.Deserialize<T>( jsonReader);
return result;
}
}
}
}
But.. The problem of parsing error occurs when BsonDocument to JsonReader coverting.
"_id" : ObjectId(" 54ab8b06d05efe1e5063941f") => String
"date" : ISODate("2015-01-06T07:13:09. 993Z") => DateTime
ObjectId and ISODate types are not converted.
I would like to know a solution for this.