How to apply soft delete filter in MongoDB Driver for C#?

I am building a .Net application using MongoDB Driver to connect to Mongo. Some of the implemented entities have an IsActive field - basically a boolean which is set to true if the entity is active and false if the entity has been deleted. (A soft or logical delete if you will)

My aim is to apply a “global filter” that would be the base of any filter applied to the given collection. Something like EF Core global query filters Global Query Filters - EF Core | Microsoft Learn

Is there anything like this for MongoDB Driver? If not, do any of you have suggestions on how to implement this in any other way?

public class User
        public string Id { get; private set; }
        public string Name { get; private set;} 
        public bool IsActive{ get; private set; }

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.