mongodb/mongo-csharp-driver — pull request #135 by carlosjln (2012-10-23 12:03:35+00:00)
Title: Writing GUIDS string instead of "$binary" when callint .ToJson() with JsonOutputMode.JavaScript

By default the driver uses JsonOutputMode.Shell when calling .ToJson() and that causes all guids to come out as a guid string wrapped in a function which is on the utilities for the shell that transforms it into its binary counterpart, but when calling .ToJson() with JsonOutputMode.JavaScript it outputs all guids as a separate object with "$binary" and "$type" attributes being "$binary" a base64 value. With the current "fix" an exception was added so that on JsonOutputMode.JavaScript the guid comes as a string which is far way simpler to use.