MongoDB LINQ ContainsAny Unsupported Filter
I’m refactoring away from the .NET Legacy MongoDB Drivers. I’ve got a query that’s written using the Legacy API’s ContainsAny() method. In the query below affectedFormFieldIds is a list of IDs.
This Throws an ArgumentException stating that this is an Unsupported Filter.
Queryable<FormSectionColumnLayoutReadModel>().Where(x => x.Fields.ContainsAny(affectedFormFieldsIds));
How do I rewrite this query using the new API
It’s
Queryable<FormSectionColumnLayoutReadModel>() .Where(x => affectedFormFieldsIds.Any(a => x.Fields.Contains(a)));