I'm using official Mongo C# driver. As suggested in answer to one question I'm using the following for the 'like' operator -
Query.Matches("name", "Joe");
My question is how can I achieve the 'NotLike' functionality ?
Assuming you are using the new Query builder in version 1.5, you would do it this way:
var query = Query.Not(Query.Matches("name", "Joe"));
In version 1.5 we also introduced a new typed Query builder, which you could use this way:
var query = Query.Not(Query<C>.Matches(x => x.Name, "Joe"));
Finally, you could also write a LINQ query:
var query = collection.AsQueryable<C>().Where(x => !Regex.IsMatch(x.Name, "Joe"));