Search code examples
c#mongodbmongodb-.net-driver

Unable to access MongoCollection Class from MongoDB.Driver for C#


I am trying to access the Save() method detailed in the driver documentation, but there seems to be no definition at all of the method when I call the function from an IMongoCollection, and the class MongoCollection is not found or recognized by the IDE.

The reason I am trying to call Save() instead of Update(), is that I want it to be by _id, I am trying to implement a generic IMongoRepository() that would just update a document within a collection without needing any extra information.

error when trying to call Save()


Solution

  • Save (as well as MongoCollection class itself) is deprecated method in the Legacy driver, the current driver doesn't have this functionality, see here