Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
Exception occurs when using MongoDB driver for DotNet Core

I'm working on solution on the following stack:

  • ASP.NET Core
  • .NET Core
  • MongoDB

...using this driver for communication with the database: https://www.nuget.org/packages/MongoDB.Driver.Core/ ...version 2.4.1

I'm trying to instantiate the MongoClient like this:

var options = provider.GetService<IOptions<MongoDbSettings>>();
var client = new MongoClient(options.Value.ConnectionString);

But the last statement errors out saying:

An exception of type 'System.MissingMethodException' occurred in MongoDB.Driver.dll but was not handled in user code

and

Additional information: Method not found: 'Void MongoDB.Driver.ReadPreference..ctor

I've noticed that the class MongoClient is in the MongoDB.Driver -namespace, not in MongoDB.Driver.Core. Does that mean it is not compatible with .Net Core? If so, how do I then connect to the database?

All help appreciated!

Regards, Jon

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I ended up using this driver: http://mongodb.github.io/mongo-csharp-driver/

version 2.3.0, which solved the problem.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!