I am getting the following error with the latest MongoDB C# driver.
System.MissingMethodException MongoDB.Bson.GuidRepresentationMode MongoDB.Bson.BsonDefaults.get_GuidRepresentationMode()
The exception occurs in MongoClient:
var client = new MongoClient("mongodb+srv://____:___@_____.nrzff.mongodb.net/____?retryWrites=true&w=majority");
var database = client.GetDatabase("ResultsModelSummary");
var collection = database.GetCollection<BsonDocument>("Zones");
var bsonDocList = new List<BsonDocument>();
foreach (var r in resModSums) {
var bsonDoc = BsonDocument.Parse(Serialization.Serialize<ResultsModelSummary>(r));
bsonDocList.Add(bsonDoc);
}
collection.InsertManyAsync(bsonDocList);
public class ResultsModelSummary
{
// META
public string RunID { get; set; } // this is a stringified GUID
public string TimeStamp { get; set; }
// more fields .....
}
The exception actually occurs irregularly. Sometimes the above code works fine.
Any suggestions?
Adding more information:
System.MissingMethodException HResult=0x80131513 Message=Method not found: 'MongoDB.Bson.GuidRepresentationMode MongoDB.Bson.BsonDefaults.get_GuidRepresentationMode()'.
Source=MongoDB.Driver StackTrace: at MongoDB.Driver.MongoUrl..ctor(String url) at MongoDB.Driver.MongoClient..ctor(String connectionString) at EnergyMLGH.MongoDB.<>c__DisplayClass1_0.b__0() in C:\Users...\MongoDB.cs:line 52 at System.Threading.Tasks.Task.Execute()
User contributions licensed under CC BY-SA 3.0