This project has moved and is read-only. For the latest updates, please go here.

Json.Net using BsonWriter and MongoDb

Feb 16, 2010 at 7:03 PM


I read somewhere that you have tested the BsonWriter with MongoDb. Do you have any testcode on this that you could share? I can't get it to work? How did you handle the serialization of the custom "_id"?


Feb 16, 2010 at 9:39 PM

I compared it against the results produced by the .NET mongo db driver. All BSON unit tests are under the Src/Newtonsoft.Json.Texts/Bson directory.

Mar 1, 2010 at 7:18 AM


Of course it was me that serialized it to the pipestream in a incorrect manner.

A follow up question though.

Which is the best way to add custom support for datatypes and control how they are serialized to BSON? E.g. MongoDb's ObjectId?