How to search in case insensitive way through C#


I am using following code:

var client = new MongoClient("mongodb+srv://");
var database = client.GetDatabase("PTITSCurve");
var collection = database.GetCollection<BsonDocument>("PlanningData");

var filter = Builders<BsonDocument>.Filter.Eq("WSID", WSId);
var projection = Builders<BsonDocument>.Projection.Exclude("_id");
 System.Collections.Generic.IEnumerable<MongoDB.Bson.BsonDocument> bsonResult = collection.Find<BsonDocument>(filter).Project(projection).ToList();

Yours sincerely

I think you might find the following useful.


can it be done with out making index, because i want to search fillter on other cols and with out indexs.
even i am ready to change the collation.

yours sincerley

The concept of collation will help you.

sorry the db is sombodys , he is not allowing to change the collation , so if i can set some thing in connection string or with out collation , then it would be help full, pls give example i am new and do not have time as i have to delever.

If you go back to the link I posted you will find that find() supports collation so it does not involve any index or collection changes.