{"issue":{"state":"closed","created_at":"2011-08-25T17:46:11Z","updated_at":"2011-11-22T13:27:14Z","comments":3,"user":{"gravatar_id":"745c87b4e36ae023847772bb6db10ca3","id":445872,"url":"https://api.github.com/users/gduford","avatar_url":"https://secure.gravatar.com/avatar/745c87b4e36ae023847772bb6db10ca3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"gduford"},"body":"Hi,\r\nI'd like to implement the following using FluentMongo (this is a LINQPad query):\r\n\r\n\tvoid Main() \r\n\t{\r\n\t\tMongoServer mongo = MongoServer.Create(new MongoConnectionStringBuilder() { Server = new MongoServerAddress(\"localhost\") } );\r\n\t\tMongoDatabase database = mongo[\"Demo\"];\r\n\t\tMongoCollection<Employee> employeeCollection = database.GetCollection<Employee>(\"Employees\");\r\n\t\t\r\n\t\tEmployee emp1 = new Employee() { Name = \"Bob\" };\r\n\t\temp1.Departments.Add(\"Dep1\");\r\n\t\temp1.Departments.Add(\"Dep2\");\r\n\r\n\t\tEmployee emp2 = new Employee() { Name = \"Binette\" };\r\n\t\temp2.Departments.Add(\"Dep2\");\r\n\t\temp2.Departments.Add(\"Dep3\");\r\n\t\t\r\n\t\temployeeCollection.InsertBatch(new[] { emp1, emp2 });\r\n\t\t\r\n\t\tIEnumerable<Employee> searchResult =\r\n\t\t\temployeeCollection\r\n\t\t\t.Find(Query.In(\"Departments\", BsonArray.Create(new [] { \"Dep1\", \"Dep2\" })));\r\n\r\n\t\tsearchResult.Dump(); // LINQPad dumps the result to the output.\r\n\t\t\r\n\t\temployeeCollection.RemoveAll();\r\n\t}\r\n\r\n\tclass Employee\r\n\t{\r\n\t\tpublic Employee()\r\n\t\t{\r\n\t\t\tDepartments = new List<string>();\r\n\t\t}\r\n\r\n\t\tpublic ObjectId Id { get; set; }\r\n\t\tpublic string Name { get; set; }\r\n\t\tpublic List<string> Departments\r\n\t\t{ \r\n\t\t\tget; \r\n\t\t\tprivate set; \r\n\t\t}\r\n\t}\r\n\r\nIntuitively, I would implement the query like this in FluentMongo, but I get a NotSupportException:\r\n\tIEnumerable<Employee> searchResult2 =\r\n\t\temployeeCollection\r\n\t\t.AsQueryable()\r\n\t\t.Where(o => o.Departments.Intersect(new [] { \"Dep1\", \"Dep2\" }).Any());\r\n\r\nIs there a better way to implement this kind of query in FluentMongo?\r\nThanks,\r\n\r\ngabriel","assignee":null,"id":1484572,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":22,"labels":[],"title":"Add support for $in where the property is an array","closed_at":"2011-11-22T13:27:14Z","html_url":"https://github.com/craiggwilson/fluent-mongo/issues/22","url":"https://api.github.com/repos/craiggwilson/fluent-mongo/issues/22","milestone":null},"action":"closed"}