MongoDB.live, free & fully virtual. June 9th - 10th. Register Now MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

How to put trim()

List bsonPlanData = database.GetCollection(Startup.mongoDB_ScurvePlanCollection).AsQueryable().Where(w => w.BridgeId.ToUpper() == BridgeId.ToUpper()).ToList();

i am not able to put trim after ToUpper();

Hi @Rajesh_Yadav,

If you’re referring to calling Trim() for w.BridgeId in comparison, currently that’s not supported. There’s an open ticket: CSHARP-2077, feel free to watch/up-vote to receive notifications on it.
Ideally the value should be trimmed before insertion to the database. As an alternative, you can use Contains(), for example:

var planData = collection.AsQueryable()
               .Where(
                    w => w.BridgeId.ToUpper().Contains(BridgeId.ToUpper())
               );

Regards,
Wan.