[CSHARP-4002] Add a filtered collection that adds a filter to each operation Created: 30/Dec/21  Updated: 31/Mar/22

Status: Backlog
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Unknown
Reporter: Bar Arnon Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Similarly to OfType<TDerived> that returns a collection instance filtered only to a specific document type WithFilter(FilterDefinition) can return an instance that filtered only to documents that pass that specific filter



 Comments   
Comment by Bar Arnon [ 04/Jan/22 ]

Thank you.
I already made a working PR if that helps the process: https://github.com/mongodb/mongo-csharp-driver/pull/713

I'm more than happy to push this to completion if there are other requirements. 

Comment by Robert Stam [ 04/Jan/22 ]

Thank you for your suggestion. It seems quite reasonable. We will consider adding this in a future release.

Comment by Bar Arnon [ 30/Dec/21 ]

We've been using this pattern for a while now.. I made it work by using reflection to push an additional filter into the OfTypeMongoCollection instance.

It would be useful to have that feature built in to the library.

Generated at Wed Feb 07 21:46:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.