Posts

Showing posts from November, 2022

Core Web API issues Related to Mongo DB - IMongoCollection<> could not be found AND System.FormatException at MongoDB.Bson.Serialization.BsonClassMapSerializer

Image
 .NET Core and Mongo DB is a good bonding pair in Full Stack frame. Today, two issues I'm going to elaborate here and those two issues has been raised while developing Web API using .NET Core platform and use Mongo DB as backend. Web API will call the Mongo DB and fetch the record, specific record, and able to update the record as well. Simple and straight forward. Build is successful. However, when I try to run this and actually test in browser, get the following error. Obvious this occurred at start up. Below the error. Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'IMongoCollection<>' could not be found (are you missing a using directive or an assembly reference?) MVCCoreApi MVCCoreApi\Services\MovieService.cs One important note here, you should have MongoDb driver  installed at your end so that you can add  using MongoDB.Driver;  in your project and work with  IMongoCollection ...