I am trying to use hotchocolate and MongoDbFiltering in c#. I need to be able to query for a name without worrying about case. I was able to create an index with collation and that works for name eq string, but I need the name field to contain string.
GraphQl Query example that works with eq
users(where:{name:{eq:"elmer fudd"}})
{
nodes { id name}
}
What I need is
users(where:{name:{contains:"elmer"}})
{
nodes { id name}
}
server side looks like this
Collection.Find<User>(filter, new FindOptions { Collation = new Collation("en", strength: CollationStrength.Secondary) }).AsExecutable();
Thanks!