-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
-
Summary
Given a model like this:
public Model { public List<string> Foo {get; set;} }
Where the value is null or missing in mongodb. And a LINQ query like this:
var lookingFor = new List<string> { "value1", "value2" }; var rows = collection.Where(model => lookingFor.Any(value => model.Foo.Contains(value))).ToList();
The query will fail with MongoCommandException: "Command aggregate failed: $in requires an array as a second argument, found: missing."
Rewriting the LINQ query slightly:
var rows = collection.Where(model => model.Foo.Any(value => lookingFor.Contains(value))).ToList()
And the query succeeds. This query worked in LINQ2.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
Driver 2.20 using LINQ3
How to Reproduce
See above.
Additional Background
Discovered when LINQ3 is now the default LinqProvider.