Popular blog tags

Mongodb version: 3.60

Error : The GuidRepresentation for the reader is CSharpLegacy, which requires the binary sub type to be UuidLegacy, not UuidStandard. possible options for uuidRepresentation is below:[ Standard | CSharplegacy | JavaLegacy | PythonLegacy ]  

  Solution 1.modify the global setting

 BsonDefaults.GuidRepresentation BsonDefaults.GuidRepresentation = GuidRepresentation.Standard;

Solution 2.specify the setting when you create your collection

IMongoDatabase db = ???;

string collectionName = ???;

var collectionSettings = new MongoCollectionSettings

{

GuidRepresentation = GuidRepresentation.Standard

};

var collection = db.GetCollection<BsonDocument>(collectionName, collectionSettings);

Solution 3.update to .NET Driver Version 2.5.x.

NET Driver Version 2.5.0 Release Notes say below:

The main new feature of 2.5.0 is support for the new features of the 3.6 version of the server:...Improved support for reading and writing UUIDs in BsonBinary subtype 4 format    .