Mongo Db global filter with C#

39 Views Asked by At

I'm developing a C# application where some classes will have "soft delete" functionality, meaning that records marked as deleted will still remain in the database but won't be considered in standard read operations. To implement this, I'm using the MongoDB database and I've defined an interface called ISoftDelete, which contains a single field named IsDeleted.

Now, when querying a collection that implements the ISoftDelete interface, I want to ensure that only records where the IsDeleted field is false are returned. How can I implement this global filter without using EntityFramework? Can I implement using MongoDb.Driver?

I didn't really understand how to make a global filter using mongo in C#.

0

There are 0 best solutions below