In operators for query builders and Linq extension should take regular expressions as arguments when the operator is a string.
Original report:
--------------------------------
Could you please verify if there is an option to build a linq query equivalent to the mongo query:
db.Feeds.find({ShortDescription:{$in:[/sunil/, /raj/]}})
I have tried:
MongoCollection<BsonDocument> feedscollection = _db.database.GetCollection<BsonDocument>("Feeds");
var feeds = (from f in feedscollection.AsQueryable<Feeds>()
select f);
string tags="1)Lorem ipsum sunil dolor sit amet, 2)Maecenas raj pretium laoreet nibh, 3)a rhoncus turpis cursus gravida";
var searchwordlist = tags.ToLower().Split(new char[]
, StringSplitOptions.RemoveEmptyEntries).Select(s => string.Format("/
{0}/", s)).ToList();
feeds = feeds.Where(f => f.ShortDescription.In(searchwordlist));
//With the mongo query I am getting the first and second sentence. But when I go with the linq -> mongo query, I am not getting any results.
- duplicates
-
CSHARP-495 The "In" operator matches the whole element in the input array. So a query with "In" with "Contains" is not possible.
- Closed