With the following model
public class Product{
[BsonId][BsonRepresentation{BsonType.ObjectId}]
public string Id {get; set;}
public string ItemName {get; set;}
}
I want to write the following query:
var items = Db.Products.Find(x => SearchText.Contains(x.ItemName)).ToList();
But mongodDB gives me an error saying the query is invalid and that I can't do String.Contains(x.Field)
So how can I check if a field is contained within a string using MongoDB.Driver
library